Class: Action
- Inherits:
-
Object
- Object
- Action
- Defined in:
- lib/software_challenge_client/action.rb
Overview
An action is a part of a move. A move can have multiple actions. The specific actions are inherited from this Action class which should be considered abstract/interface.
Direct Known Subclasses
Instance Method Summary collapse
- #==(_other) ⇒ Object
-
#invalid(message) ⇒ Object
Helper to make raising InvalidMoveExceptions easier.
- #perform!(_gamestate, _current_player) ⇒ Object
-
#type ⇒ ActionType
Type of the action.
Instance Method Details
#==(_other) ⇒ Object
12 13 14 |
# File 'lib/software_challenge_client/action.rb', line 12 def ==(_other) raise 'must be overridden' end |
#invalid(message) ⇒ Object
Helper to make raising InvalidMoveExceptions easier. It is defined in the Action class instead of the Move class because performing individual actions normally trigger invalid moves, not the move itself.
26 27 28 |
# File 'lib/software_challenge_client/action.rb', line 26 def invalid() raise InvalidMoveException.new(, self) end |
#perform!(_gamestate, _current_player) ⇒ Object
16 17 18 |
# File 'lib/software_challenge_client/action.rb', line 16 def perform!(_gamestate, _current_player) raise 'must be overridden' end |
#type ⇒ ActionType
Returns Type of the action.
8 9 10 |
# File 'lib/software_challenge_client/action.rb', line 8 def type raise 'must be overridden' end |