Class: Profig::Section

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#itemsObject (readonly)

Returns the value of attribute items.



22
23
24
# File 'lib/profig/config.rb', line 22

def items
  @items
end

#typeObject (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_sObject



36
37
38
# File 'lib/profig/config.rb', line 36

def to_s()
	return "#<Profig::Section:#{@type}>"
end