Class: Gameworks::Game::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/gameworks/game_snapshot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ Snapshot

Returns a new instance of Snapshot.



6
7
8
9
10
# File 'lib/gameworks/game_snapshot.rb', line 6

def initialize(game)
  @player_scores = {}
  game.players.each{ |p| @player_scores[p] = p.score }
  @state = game.state
end

Instance Attribute Details

#player_scoresObject (readonly)

Returns the value of attribute player_scores.



4
5
6
# File 'lib/gameworks/game_snapshot.rb', line 4

def player_scores
  @player_scores
end

#stateObject (readonly)

Returns the value of attribute state.



4
5
6
# File 'lib/gameworks/game_snapshot.rb', line 4

def state
  @state
end