Class: Hocon::Impl::Tokens::Value

Inherits:
Token
  • Object
show all
Defined in:
lib/hocon/impl/tokens.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, orig_text = nil) ⇒ Value

Returns a new instance of Value.



29
30
31
32
# File 'lib/hocon/impl/tokens.rb', line 29

def initialize(value, orig_text = nil)
  super(TokenType::VALUE, value.origin, orig_text)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



34
35
36
# File 'lib/hocon/impl/tokens.rb', line 34

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



49
50
51
# File 'lib/hocon/impl/tokens.rb', line 49

def ==(other)
  super(other) && other.value == @value
end

#can_equal(o) ⇒ Object



45
46
47
# File 'lib/hocon/impl/tokens.rb', line 45

def can_equal(o)
  o.is_a?(Value)
end

#hashObject



53
54
55
# File 'lib/hocon/impl/tokens.rb', line 53

def hash
  41 * (41 + super) + value.hash
end

#to_sObject



36
37
38
39
40
41
42
43
# File 'lib/hocon/impl/tokens.rb', line 36

def to_s
  if value.resolve_status == ResolveStatus::RESOLVED
    "'#{value.unwrapped}' (#{Hocon::ConfigValueType.name(value.value_type)})"
  else
    "'<unresolved value>' (#{@value.value_type.name})"
  end

end