Class: Profig::Section
- Inherits:
-
Object
- Object
- Profig::Section
- Defined in:
- lib/profig/config.rb
Overview
A group of configuration items that are of the same type and should be handled at the same time
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<<(item) ⇒ Object
-
#initialize(type) ⇒ Section
constructor
A new instance of Section.
- #to_s ⇒ Object
Constructor Details
#initialize(type) ⇒ Section
Returns a new instance of Section.
24 25 26 27 |
# File 'lib/profig/config.rb', line 24 def initialize(type) @type = type @items = [] end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
22 23 24 |
# File 'lib/profig/config.rb', line 22 def items @items end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
21 22 23 |
# File 'lib/profig/config.rb', line 21 def type @type end |
Instance Method Details
#<<(item) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/profig/config.rb', line 29 def <<(item) if not item.instance_of? Item raise 'Unknown item type' end @items << item end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/profig/config.rb', line 36 def to_s() return "#<Profig::Section:#{@type}>" end |