Class: Paxmex::ParsedSection
- Inherits:
-
Hash
- Object
- Hash
- Paxmex::ParsedSection
- Defined in:
- lib/paxmex/parsed_section.rb
Instance Attribute Summary collapse
-
#section ⇒ Object
readonly
Returns the value of attribute section.
Instance Method Summary collapse
- #add_child(key, child) ⇒ Object
- #children ⇒ Object
-
#initialize(section, raw_result = {}, &blk) ⇒ ParsedSection
constructor
A new instance of ParsedSection.
- #key ⇒ Object
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
#section ⇒ Object (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 |
#children ⇒ Object
16 17 18 |
# File 'lib/paxmex/parsed_section.rb', line 16 def children self[:children] end |
#key ⇒ Object
12 13 14 |
# File 'lib/paxmex/parsed_section.rb', line 12 def key section.key end |