Class: Tundengine::Stages::Turn
- Defined in:
- lib/tundengine/stages/turn.rb
Instance Attribute Summary collapse
-
#card ⇒ Object
readonly
Returns the value of attribute card.
Attributes inherited from Base
#child_in_play, #children, #parent
Instance Method Summary collapse
- #as_hash ⇒ Object
-
#initialize(trick) ⇒ Turn
constructor
A new instance of Turn.
- #on_completed!(card, beats) ⇒ Object
- #play!(card = Cards::Null.instance) ⇒ Object
- #player_in_round ⇒ Object
Methods inherited from Base
#declare!, #fast_forward!, #lock!, #on_complete_child!, #rewind!
Constructor Details
Instance Attribute Details
#card ⇒ Object (readonly)
Returns the value of attribute card.
5 6 7 |
# File 'lib/tundengine/stages/turn.rb', line 5 def card @card end |
Instance Method Details
#as_hash ⇒ Object
28 29 30 |
# File 'lib/tundengine/stages/turn.rb', line 28 def as_hash { player: player.name, card: card.to_s } end |
#on_completed!(card, beats) ⇒ Object
23 24 25 26 |
# File 'lib/tundengine/stages/turn.rb', line 23 def on_completed!(card, beats) @card = card trick.on_complete_child!(beats) end |
#play!(card = Cards::Null.instance) ⇒ Object
19 20 21 |
# File 'lib/tundengine/stages/turn.rb', line 19 def play!(card = Cards::Null.instance) player.play!(card) end |
#player_in_round ⇒ Object
15 16 17 |
# File 'lib/tundengine/stages/turn.rb', line 15 def player_in_round player.in_round end |