Module: PokerEngine::Reducer

Defined in:
lib/poker_engine/reducer.rb

Defined Under Namespace

Modules: Actions

Class Method Summary collapse

Class Method Details

.allowed_actionsObject



13
14
15
# File 'lib/poker_engine/reducer.rb', line 13

def self.allowed_actions
  @allowed_actions ||= Actions.methods(false)
end

.call(state, action) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/poker_engine/reducer.rb', line 5

def self.call(state, action)
  raise "Unknown action #{action[:type]}" unless allowed_actions.include? action[:type]

  Actions
    .public_send(action[:type], state, action)
    .put(:last_action, action)
end