module Redux

Constants

VERSION

Public Class Methods

combine_reducers(reducers) click to toggle source
# File lib/redux.rb, line 5
def self.combine_reducers(reducers)
  ->(state = {}, action){
    reducers.reduce({}){ |next_state, (key, reducer)|
      if state.key?(key)
        next_state[key] = reducer.call(state[key], action)
      else
        next_state[key] = reducer.call(action)
      end

      next_state
    }
  }
end