Module: Interaktor::Organizer::InstanceMethods

Defined in:
lib/interaktor/organizer.rb

Instance Method Summary collapse

Instance Method Details

#callvoid

This method returns an undefined value.

Invoke the organized Interaktors. An Interaktor::Organizer is expected NOT to define its own #call in favor of this default implementation.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/interaktor/organizer.rb', line 41

def call
  latest_interaction = nil

  self.class.organized.each do |interaktor|
    catch(:early_return) do
      latest_interaction = interaktor.call!(latest_interaction || @interaction)
    end
  end

  if defined?(self.class::SuccessAttributesModel)
    @interaction.success!(
      latest_interaction
        .success_object
        &.attributes
        &.slice(*self.class::SuccessAttributesModel.attribute_names) || {}
    )
  end
end