class Rudux::Store

Attributes

state[R]

Public Class Methods

new(reducer, state) click to toggle source
# File lib/rudux/store.rb, line 5
def initialize reducer, state
  @reducer = reducer
  @state   = state
end

Public Instance Methods

dispatch(actions) click to toggle source
# File lib/rudux/store.rb, line 10
def dispatch actions
  Array(actions).each do |action|
    @state = @reducer.reduce(@state, action)
  end
end
reset(state) click to toggle source
# File lib/rudux/store.rb, line 16
def reset state
  @state = state
end
select(selector) click to toggle source
# File lib/rudux/store.rb, line 20
def select selector
  selector.select(@state)
end