Module: Adama::Invoker

Defined in:
lib/adama/invoker.rb

Overview

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)

Defined Under Namespace

Modules: InstanceMethods, InvokeMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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