Class: Casino::Lobby

Inherits:
Object
  • Object
show all
Defined in:
lib/casino/lobby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ Lobby

Returns a new instance of Lobby.



5
6
7
# File 'lib/casino/lobby.rb', line 5

def initialize(klass)
  self.collection = klass
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



3
4
5
# File 'lib/casino/lobby.rb', line 3

def collection
  @collection
end

Instance Method Details

#add_registry(object) ⇒ Object



13
14
15
16
17
18
# File 'lib/casino/lobby.rb', line 13

def add_registry(object)
  key = object.class.name.downcase.split("::").last.to_sym
  registry[key] ||= Array.new
  registry[key] << object
  registry[key] = registry[key].uniq
end

#registryObject



9
10
11
# File 'lib/casino/lobby.rb', line 9

def registry
  @registry ||= Hash.new
end