class MatchPlay::PlayActions
Class to help work with actions:
-
Indicate whether a particular action is enabled
-
Get a hash of all enabled actions
-
Execute an action
actions include :win_game
, :start_game
, and
:discard_play
. See Match#play_match!
Public Class Methods
new(match)
click to toggle source
-
Args
-
match
-> Match
-
# File app/models/concerns/match_play.rb, line 16 def initialize(match) @match = match end
Public Instance Methods
lookup_method(action)
click to toggle source
Lookup the methods to handle a particular action
-
Args :
-
action
->:win_game
,:start_game
etc.
-
-
Returns : Hash or nil
-
:exec
- method to execute the action -
:query
- method to determine if the action is enabled
-
# File app/models/concerns/match_play.rb, line 27 def lookup_method(action) action = action.to_sym play_methods_table[action] if play_methods_table.has_key? action end
valid_actions()
click to toggle source