Module: GameOverseer::Services
- Defined in:
- lib/gameoverseer/services/services.rb
Constant Summary collapse
- LIST =
[]
- ACTIVE =
[]
Class Method Summary collapse
-
.client_connected(client_id, ip_address) ⇒ Object
Tells all services that have ‘client_connected’ defined that ‘client_id’ has connected.
-
.client_disconnected(client_id) ⇒ Object
Tells all services that have ‘client_disconnected’ defined that ‘client_id’ is now disconnected.
-
.enable ⇒ Object
instantiates the Services in ‘LIST’ and adds them to the ‘ACTIVE’ list.
-
.register(klass) ⇒ Object
Adds klass to list.
Class Method Details
.client_connected(client_id, ip_address) ⇒ Object
Tells all services that have ‘client_connected’ defined that ‘client_id’ has connected
24 25 26 27 28 |
# File 'lib/gameoverseer/services/services.rb', line 24 def self.client_connected(client_id, ip_address) ACTIVE.each do |service| service.client_connected(client_id, ip_address) if defined?(service.client_connected) end end |
.client_disconnected(client_id) ⇒ Object
Tells all services that have ‘client_disconnected’ defined that ‘client_id’ is now disconnected
32 33 34 35 36 |
# File 'lib/gameoverseer/services/services.rb', line 32 def self.client_disconnected(client_id) ACTIVE.each do |service| service.client_disconnected(client_id) if defined?(service.client_disconnected) end end |
.enable ⇒ Object
instantiates the Services in ‘LIST’ and adds them to the ‘ACTIVE’ list
13 14 15 16 17 18 19 |
# File 'lib/gameoverseer/services/services.rb', line 13 def self.enable LIST.each do |service| _service = service.new GameOverseer::Console.log "Services> #{_service.class} #{_service.version}" ACTIVE << _service end end |
.register(klass) ⇒ Object
Adds klass to list
8 9 10 |
# File 'lib/gameoverseer/services/services.rb', line 8 def self.register(klass) LIST << klass end |