Sha256: 64317e2117b6c4d5e8e1448c8dd42c8080fda71bfdd5b5550f0756501fa23f05
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
# ServiceIt [![Gem Version](https://badge.fury.io/rb/service_it.svg)](https://badge.fury.io/rb/service_it) <div align="center"> <img src="https://pbs.twimg.com/profile_images/1123677732/logo_avatar_large.png" height="250" width="250"> <p>Its main objective is to provide you a way to delegate responsibilities in your project</p> </div> <br/> ## Installation Add this line to your application's Gemfile: gem 'service_it', '0.1.5' And then execute: $ bundle Or install it yourself as: $ gem install service_it ## Usage Inherit your class of `Service` and implement `perform` method ```ruby class Foo < Service def perform # here you can use params that became instance variables end end ``` Call your service from anywhere ```ruby Foo.call(params) ``` ## Example Simple example to change status of a "transaction" to complete ```ruby # app/services/complete_transation_service.rb class CompleteTransation < Service def perform @transation.update(:status, :complete) end end ``` ```ruby if CompleteTransation.call(transation: @transation) puts 'Transation complete!' end ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/iago-silva/service_it. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
service_it-0.1.5 | README.md |