class Gameworks::GameRegistry
Public Class Methods
new()
click to toggle source
# File lib/gameworks/game_registry.rb, line 3 def initialize @instances = {} end
Public Instance Methods
add(game)
click to toggle source
# File lib/gameworks/game_registry.rb, line 7 def add(game) @instances[game.id] = game end
as_json()
click to toggle source
# File lib/gameworks/game_registry.rb, line 15 def as_json @instances.map do |id, game| { 'id' => game.id, 'state' => game.state } end end
instance(id)
click to toggle source
# File lib/gameworks/game_registry.rb, line 11 def instance(id) @instances[id] end
to_json()
click to toggle source
# File lib/gameworks/game_registry.rb, line 21 def to_json as_json.to_json end