Class: Groups

Inherits:
Object
  • Object
show all
Defined in:
lib/tbr/groups.rb

Instance Method Summary collapse

Constructor Details

#initializeGroups

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

#sizeObject



18
19
20
# File 'lib/tbr/groups.rb', line 18

def size
	@groups.size
end