Class: Big3::GameManager

Inherits:
Object
  • Object
show all
Defined in:
lib/big_3/game_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ GameManager

Returns a new instance of GameManager.



5
6
7
# File 'lib/big_3/game_manager.rb', line 5

def initialize(args={})
  @ids = args[:ids]
end

Instance Attribute Details

#idsObject

Returns the value of attribute ids.



3
4
5
# File 'lib/big_3/game_manager.rb', line 3

def ids
  @ids
end

Instance Method Details

#create_gamesObject



9
10
11
12
13
# File 'lib/big_3/game_manager.rb', line 9

def create_games
  unordered_games = ids.map { |id| Game.new(id) } 
  games = unordered_games.sort! { |a, b| a.date <=> b.date }
  games
end