README.md in business_pipeline-0.1.0 vs README.md in business_pipeline-0.1.1

- old
+ new

@@ -126,19 +126,19 @@ ### Calling a Process When calling a Process, you can provide an initial _context_ by passing a Hash as argument: ```ruby -UsersIndex.new.call(page: 1, sort: { created_at: :desc }) +UsersIndex.new.perform(page: 1, sort: { created_at: :desc }) ``` You can then use this initial _context_ in all your Steps. A Process returns the modified _context_ at the end of its execution. You can interrogate this _context_ to know if everything went according to plan: ```ruby -result = UsersIndex.new.call(page: 1, sort: { created_at: :desc }) +result = UsersIndex.new.perform(page: 1, sort: { created_at: :desc }) result.success? # => true result.failure? # => false result.users # => …sorted and paginated list of users… ``` @@ -151,11 +151,11 @@ Before we get started we need to first take a look at a Process' initialization. It actually accepts a Hash that will act somewhat like `context` but should contain data that _define_ the Process as opposed to `context` that is more related to the _execution_ of the Process. ```ruby process = IndexProcess.new(collection_name: 'users', model_class: User) -process.call(page: 1, sort: { created_at: :desc }) +process.perform(page: 1, sort: { created_at: :desc }) ``` ### Generic Steps Now that we initialized our Process with a _config_ let's change our Process' code and our Steps. @@ -223,11 +223,11 @@ puts "Calling process: #{process.class}" puts "Config is: #{config.inspect}" puts "Context before call is: #{context.inspect}" - process.call + process.perform puts "Context after call is: #{context.inspect}" end before :some_method @@ -248,20 +248,20 @@ class IndexProcess include BusinessPipeline::Process around do |process| puts 'AROUND 1 START' - process.call + process.perform puts 'AROUND 1 END' end before { puts 'BEFORE 1' } before { puts 'BEFORE 2' } around do |process| puts 'AROUND 2 START' - process.call + process.perform puts 'AROUND 2 END' end after { puts 'AFTER 1' } after { puts 'AFTER 2' } @@ -288,11 +288,11 @@ If for instance you wanted to wrap every Process in a transaction (which would be a good idea by the way :wink:), you can define it this way: ```ruby class TransactionWrapping def call(process, context, config) - ActiveRecord::Base.transaction { process.call } + ActiveRecord::Base.transaction { process.perform } end end class ApplicationProcess include BusinessPipeline::Process @@ -392,10 +392,10 @@ ``` Calling `context.fail!` will stop the execution and merge the information you give it to the _context_. ```ruby -result = CheckingProcess.new.call(continue: 'no') +result = CheckingProcess.new.perform(continue: 'no') result.success? # => false result.failure? # => true result.error # => 'Continue is not set to yes' ```