WFlow

Gem Version Build Status Code Climate Test Coverage Dependency Status

WFlow aims to help on designing workflows based on Single Responsibility Principle. WFlow proposes to achieve this by providing tools to build classes where each are responsible for a task and one task only, and by providing tools to compose these classes.

Word of appreciation for usecasing, interactor and rest_my_case that served as inspiration for this gem.

Dependencies

Tested with:

  • ruby 2.2.1, 2.2.0, 2.1.1, 2.0.0

Installation

Add this line to your application's Gemfile:

gem 'w_flow'

And then execute:

$ bundle

Or install it yourself as:

$ gem install w_flow

Usage

On its most simplest form a task (in WFlow called a Process) is something like this:

class SaveUser
  include WFlow::Process

  def perform
    # arguments passed to run will be under flow.data
    flow.data.user.save
  end
end

# run process, it will return a report object
report = SaveUser.run(user: current_user)

report.data.success?

Contributing

  1. Fork it ( https://github.com/junhanamaki/w_flow/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request