Class: Groups
- Inherits:
-
Object
- Object
- Groups
- Defined in:
- lib/tbr/groups.rb
Instance Method Summary collapse
- #each(&blk) ⇒ Object
- #group(name) ⇒ Object
-
#initialize ⇒ Groups
constructor
Groups container.
- #size ⇒ Object
Constructor Details
#initialize ⇒ Groups
Groups container
5 6 7 |
# File 'lib/tbr/groups.rb', line 5 def initialize @groups = Hash.new end |
Instance Method Details
#each(&blk) ⇒ Object
22 23 24 |
# File 'lib/tbr/groups.rb', line 22 def each(&blk) Hash[@groups.sort].each_value(&blk) end |
#group(name) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/tbr/groups.rb', line 9 def group(name) return nil if name.nil? or name.empty? unless @groups.include?(name) @groups[name] = Group.new(name) end @groups[name] end |
#size ⇒ Object
18 19 20 |
# File 'lib/tbr/groups.rb', line 18 def size @groups.size end |