SimpleOperation

The idea behind SimpleOperation is to provide a very basic class creator that facilitates using service objects.

Installation

Add this line to your application's Gemfile:

gem 'simple_operation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install simple_operation

Usage

Example usage for SimpleOperation is creating user:

class CreateUser < SimpleOperation.new(:login, :password)

  def call
    user = User.new(, password)
    validate_user(user)
    UserRepository.persist(user)
    user
  end

  private
    def validate_user(user)
      !UserRepository.fetch_all_logins.include?(user.)
    end

end


CreateUser.('Grzegorz', '[email protected]')

Contributing

  1. Fork it ( https://github.com/[my-github-username]/simple_operation/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