Class: Rubygoal::Recorder
- Inherits:
-
Object
- Object
- Rubygoal::Recorder
- Defined in:
- lib/rubygoal/recorder.rb
Instance Method Summary collapse
-
#initialize(game) ⇒ Recorder
constructor
A new instance of Recorder.
- #to_hash ⇒ Object
- #update ⇒ Object
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_hash ⇒ Object
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 |
#update ⇒ Object
10 11 12 |
# File 'lib/rubygoal/recorder.rb', line 10 def update @frames << frame_info end |