class Hocon::Impl::Tokens::Substitution

This is not a Value, because it requires special processing

Attributes

value[R]

Public Class Methods

new(origin, optional, expression) click to toggle source
Calls superclass method
# File lib/hocon/impl/tokens.rb, line 249
def initialize(origin, optional, expression)
  super(TokenType::SUBSTITUTION, origin)
  @optional = optional
  @value = expression
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/hocon/impl/tokens.rb, line 279
def ==(other)
  super(other) && other.value == @value
end
can_equal(other) click to toggle source
# File lib/hocon/impl/tokens.rb, line 275
def can_equal(other)
  other.is_a?(Substitution)
end
hash() click to toggle source
Calls superclass method
# File lib/hocon/impl/tokens.rb, line 283
def hash
  41 * (41 + super + @value.hash)
end
optional?() click to toggle source
# File lib/hocon/impl/tokens.rb, line 255
def optional?
  @optional
end
to_s() click to toggle source
# File lib/hocon/impl/tokens.rb, line 267
def to_s
  sb = StringIO.new
  value.each do |t|
    sb << t.to_s
  end
  "'${#{sb.to_s}}'"
end
token_text() click to toggle source
# File lib/hocon/impl/tokens.rb, line 261
def token_text
  sub_text = ""
  @value.each { |t| sub_text << t.token_text }
  "${" + (@optional ? "?" : "") + sub_text + "}"
end