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.



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

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.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



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

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

#can_equal(o) ⇒ Object



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

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

#hashObject



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

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

#to_sObject



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

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

end