Class: ConfParser::Section
- Inherits:
-
Hash
- Object
- Hash
- ConfParser::Section
- Includes:
- Template
- Defined in:
- lib/confparser.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
-
#initialize(parent) ⇒ Section
constructor
A new instance of Section.
Methods included from Template
Constructor Details
#initialize(parent) ⇒ Section
Returns a new instance of Section.
56 57 58 59 |
# File 'lib/confparser.rb', line 56 def initialize (parent) super() @parent = parent end |
Class Method Details
.from_hash(parent, hash) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/confparser.rb', line 43 def from_hash (parent, hash) raise ArgumentError unless hash.is_a?(Hash) return hash if hash.is_a?(self) self.new(parent).tap {|sec| hash.each {|key, value| sec[key] = value } } end |
Instance Method Details
#[]=(key, value) ⇒ Object
61 62 63 64 |
# File 'lib/confparser.rb', line 61 def []= (key, value) raise ArgumentError unless key.is_a?(String) and value.is_a?(String) __set__(key.to_s, value.to_s) end |