A tiny Ruby redux
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
MIT-LICENSE.txt
README.md
Rakefile
redux.gemspec

README.md

redux.rb [version] [travis]

A Redux implementation in Ruby.

Setup

Add to your Gemfile:

gem 'redux'

Usage

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 # => 1

MIT License

Copyright (C) 2016 Jan Lelis http://janlelis.com. Released under the MIT license.