Class: Hearthstone::Log::GameTurn
- Inherits:
-
Object
- Object
- Hearthstone::Log::GameTurn
- Defined in:
- lib/hearthstone/log/data/game_turn.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#number ⇒ Object
Returns the value of attribute number.
-
#player ⇒ Object
Returns the value of attribute player.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #add_event(event, data, line = nil) ⇒ Object
-
#initialize(number: nil, player: nil, timestamp: nil) ⇒ GameTurn
constructor
A new instance of GameTurn.
- #to_hash ⇒ Object
Constructor Details
#initialize(number: nil, player: nil, timestamp: nil) ⇒ GameTurn
Returns a new instance of GameTurn.
7 8 9 10 11 12 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 7 def initialize(number: nil, player: nil, timestamp: nil) @events = [] @number = number @player = player @timestamp = end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
5 6 7 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 5 def events @events end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 4 def number @number end |
#player ⇒ Object
Returns the value of attribute player.
4 5 6 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 4 def player @player end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 4 def @timestamp end |
Instance Method Details
#add_event(event, data, line = nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 14 def add_event(event, data, line=nil) if line @events.push([event, data, line]) else @events.push([event, data]) end end |
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/hearthstone/log/data/game_turn.rb', line 22 def to_hash { number: number, player: player, timestamp: , events: events } end |