module Adama::Invoker

Invoker lets you run many commands in sequence, and roll them back in reverse order.

class SuccessfulBusinessCreator

include Adama::Invoker

invoke(
  CollectUnderpantsCommand,
  MagicHappensCommand,
  ProfitCommand,
)

end

SuccessfulBusinessCreator.call(min_underpants: 100)

Public Class Methods

included(base) click to toggle source

Internal: Install Command's behavior in the given class.

# File lib/adama/invoker.rb, line 19
def self.included(base)
  base.class_eval do
    # We inherit the Command module's call methods
    include Command

    # Our new class methods enable us to set the command list
    extend InvokeMethods

    # We override the Command class instance methods:
    #
    #   run
    #   call
    #   rollback
    include InstanceMethods
    include InvokeMethods
  end
end