Module: ActiveInteractor::Organizer::Perform

Included in:
Base
Defined in:
lib/active_interactor/organizer/perform.rb

Overview

Organizer perform methods. Because Perform is a module classes should include Perform rather than inherit from it.

Author:

Since:

  • 1.0.0

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Since:

  • 1.0.0



39
40
41
42
43
# File 'lib/active_interactor/organizer/perform.rb', line 39

def self.included(base)
  base.class_eval do
    class_attribute :parallel, instance_writer: false, default: false
  end
end

Instance Method Details

#performObject

Call the .organized interactors #perform. An organizer is expected not to define its own #perform method in favor of this default implementation.

Since:

  • 1.0.0



48
49
50
51
52
53
54
55
56
# File 'lib/active_interactor/organizer/perform.rb', line 48

def perform
  run_callbacks :all_perform do
    if self.class.parallel
      perform_in_parallel
    else
      perform_in_order
    end
  end
end

#run_deferred_after_perform_callbacks_on_childrenObject

Since:

  • 1.0.0



58
59
60
61
62
63
64
# File 'lib/active_interactor/organizer/perform.rb', line 58

def run_deferred_after_perform_callbacks_on_children
  self.class.organized.each do |interface|
    next unless interface.interactor_class.after_callbacks_deferred_when_organized

    context.merge!(interface.execute_deferred_after_perform_callbacks(context))
  end
end