class Hocon::Impl::Parseable::ParseableString

NOTE: skipping `ParseableReader` until we know we need it (probably should

have done that with `ParseableNotFound`)

Public Class Methods

new(string, options) click to toggle source
Calls superclass method Hocon::Impl::Parseable::new
# File lib/hocon/impl/parseable.rb, line 356
def initialize(string, options)
  super()
  @input = string
  post_construct(options)
end

Public Instance Methods

create_origin() click to toggle source
# File lib/hocon/impl/parseable.rb, line 381
def create_origin
  Hocon::Impl::SimpleConfigOrigin.new_simple("String")
end
custom_reader() click to toggle source
# File lib/hocon/impl/parseable.rb, line 362
def custom_reader
  if Hocon::Impl::ConfigImpl.trace_loads_enabled
    self.class.trace("Loading config from a String: #{@input}")
  end
  # we return self here, which will cause `open` to be called on us, so
  # we can provide an implementation of that.
  self
end
open() { |f| ... } click to toggle source
# File lib/hocon/impl/parseable.rb, line 371
def open
  if block_given?
    StringIO.open(@input) do |f|
      yield f
    end
  else
    StringIO.open(@input)
  end
end
to_s() click to toggle source
# File lib/hocon/impl/parseable.rb, line 385
def to_s
  "#{self.class.name.split('::').last} (#{@input})"
end