class FMParser::Parser::DeepHashNode

Attributes

children[R]
is_leaf[RW]

Public Class Methods

new() click to toggle source
# File lib/fmparser/parser/deep_hash_node.rb, line 7
def initialize
  @is_leaf  = false
  @children = {}
end

Public Instance Methods

==(other) click to toggle source

@param [DeepHashNode] other @reutrn [bool]

# File lib/fmparser/parser/deep_hash_node.rb, line 23
def ==(other)
  is_leaf == other.is_leaf && children == other.children
end
push_child(field, n) click to toggle source

@param [String] field @param [DeepHashNode] n

# File lib/fmparser/parser/deep_hash_node.rb, line 14
def push_child(field, n)
  if !field.is_a?(String)
    raise "Invalid field type: #{field.class}"
  end
  @children[field] = n
end
to_h() click to toggle source
# File lib/fmparser/parser/deep_hash_node.rb, line 27
def to_h
  @children.map do |field, child|
    [field, child.to_h]
  end.to_h
end