Class: Rubygoal::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygoal/recorder.rb

Instance Method Summary collapse

Constructor Details

#initialize(game) ⇒ Recorder

Returns a new instance of Recorder.



5
6
7
8
# File 'lib/rubygoal/recorder.rb', line 5

def initialize(game)
  @game   = game
  @frames = []
end

Instance Method Details

#to_hashObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/rubygoal/recorder.rb', line 14

def to_hash
  {
    teams: {
      home: @game.coach_home.name,
      away: @game.coach_away.name
    },
    score: [@game.score_home, @game.score_away],
    frames: @frames
  }
end

#updateObject



10
11
12
# File 'lib/rubygoal/recorder.rb', line 10

def update
  @frames << frame_info
end