Class: ConfParser::Section
- Inherits:
-
Hash
- Object
- Hash
- ConfParser::Section
- Defined in:
- lib/confparser.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #[](name) ⇒ Object
-
#initialize(parent) ⇒ Section
constructor
A new instance of Section.
Constructor Details
#initialize(parent) ⇒ Section
Returns a new instance of Section.
19 20 21 22 |
# File 'lib/confparser.rb', line 19 def initialize (parent) super() @parent = parent end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
17 18 19 |
# File 'lib/confparser.rb', line 17 def parent @parent end |
Instance Method Details
#[](name) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/confparser.rb', line 25 def [] (name) __get__(name).tap {|x| if x.is_a?(String) x.gsub!(/\$\((.+?)\)/) {|n| (self[$1] || parent[$1]).to_s } end } end |