Module: Interactor::Organizer::ClassMethods

Defined in:
lib/interactor/organizer.rb

Overview

Internal: Interactor::Organizer class methods.

Instance Method Summary collapse

Instance Method Details

#organize(*interactors) ⇒ Object

Public: Declare Interactors to be invoked as part of the Interactor::Organizer’s invocation. These interactors are invoked in the order in which they are declared.

interactors - Zero or more (or an Array of) Interactor classes.

Examples

class MyFirstOrganizer
  include Interactor::Organizer

  organize InteractorOne, InteractorTwo
end

class MySecondOrganizer
  include Interactor::Organizer

  organize [InteractorThree, InteractorFour]
end

Returns nothing.



47
48
49
# File 'lib/interactor/organizer.rb', line 47

def organize(*interactors)
  @organized = interactors.flatten
end

#organizedObject

Internal: An Array of declared Interactors to be invoked.

Examples

class MyOrganizer
  include Interactor::Organizer

  organize InteractorOne, InteractorTwo
end

MyOrganizer.organized
# => [InteractorOne, InteractorTwo]

Returns an Array of Interactor classes or an empty Array.



65
66
67
# File 'lib/interactor/organizer.rb', line 65

def organized
  @organized ||= []
end