Class: Paxmex::ParsedSection

Inherits:
Hash
  • Object
show all
Defined in:
lib/paxmex/parsed_section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section, raw_result = {}, &blk) ⇒ ParsedSection

Returns a new instance of ParsedSection.



4
5
6
7
8
9
10
# File 'lib/paxmex/parsed_section.rb', line 4

def initialize(section, raw_result = {}, &blk)
  @section = section
  @children = {}

  super(&blk) if block_given?
  raw_result.each { |k, v| self[k] = v }
end

Instance Attribute Details

#sectionObject (readonly)

Returns the value of attribute section.



2
3
4
# File 'lib/paxmex/parsed_section.rb', line 2

def section
  @section
end

Instance Method Details

#add_child(key, child) ⇒ Object



20
21
22
23
24
# File 'lib/paxmex/parsed_section.rb', line 20

def add_child(key, child)
  self[:children] ||= {}
  self[:children][key] ||= []
  self[:children][key] << child
end

#childrenObject



16
17
18
# File 'lib/paxmex/parsed_section.rb', line 16

def children
  self[:children]
end

#keyObject



12
13
14
# File 'lib/paxmex/parsed_section.rb', line 12

def key
  section.key
end