A Redux implementation in Ruby.
Add to your Gemfile:
gem 'redux'reducer = ->(state = 0, action){
case action['type']
when 'INCREMENT'
state + 1
when 'DECREMENT'
state - 1
else
state
end
}
store = Redux::Store.new(0, &reducer)
store.dispatch "type" => "INCREMENT"
store.state # => 1Copyright (C) 2016 Jan Lelis http://janlelis.com. Released under the MIT license.
![[travis]](proxy.php?url=https%3A%2F%2Ftravis-ci.org%2Fjanlelis%2Fredux.rb.png)