Module: Hocon::Impl::AbstractConfigNode

Includes:
Parser::ConfigNode
Included in:
AbstractConfigNodeValue, ConfigNodeField, ConfigNodeInclude, ConfigNodePath, ConfigNodeSingleToken
Defined in:
lib/hocon/impl/abstract_config_node.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



21
22
23
24
# File 'lib/hocon/impl/abstract_config_node.rb', line 21

def ==(other)
  other.is_a?(Hocon::Impl::AbstractConfigNode) &&
      (render == other.render)
end

#hashObject



26
27
28
# File 'lib/hocon/impl/abstract_config_node.rb', line 26

def hash
  render.hash
end

#renderObject



13
14
15
16
17
18
19
# File 'lib/hocon/impl/abstract_config_node.rb', line 13

def render
  orig_text = StringIO.new
  tokens.each do |t|
    orig_text << t.token_text
  end
  orig_text.string
end

#tokensObject



9
10
11
# File 'lib/hocon/impl/abstract_config_node.rb', line 9

def tokens
  raise Hocon::ConfigError::ConfigBugOrBrokenError, "subclasses of AbstractConfigNode should override `tokens` (#{self.class})"
end