module PokerEngine::Reducer

Public Class Methods

allowed_actions() click to toggle source
# File lib/poker_engine/reducer.rb, line 13
def self.allowed_actions
  @allowed_actions ||= Actions.methods(false)
end
call(state, action) click to toggle source
# 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