class Interactors::Sequence
An Interactor that is a sequence of Interactors
Public Instance Methods
call(context = {})
click to toggle source
# File lib/interactors/sequence.rb, line 18 def call(context = {}) interactions.each do |interactor| results = interactor.call(context) next if results[0] == :ok return results if results[0] == :error raise ArgumentError, "Return value from interactor must be [:ok, context] or [:error, ...]" end [:ok, context] end
compose(interactor)
click to toggle source
# File lib/interactors/sequence.rb, line 13 def compose(interactor) interactions << interactor self end
interactions()
click to toggle source
# File lib/interactors/sequence.rb, line 9 def interactions @__interactions ||= [] end