Sha256: b994fef3944eae11effadf3e7c1f4de2a79c6e1dae5b0e40430785e361aea255
Contents?: true
Size: 818 Bytes
Versions: 2
Compression:
Stored size: 818 Bytes
Contents
module Interactor module Organizer def self.included(base) base.class_eval do include Interactor extend ClassMethods include InstanceMethods end end module ClassMethods def interactors @interactors ||= [] end def organize(*interactors) @interactors = interactors.flatten end end module InstanceMethods def interactors self.class.interactors end def perform interactors.each do |interactor| instance = interactor.perform(context) rollback && break if failure? performed << instance end end def rollback performed.reverse_each(&:rollback) end def performed @performed ||= [] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
interactor-2.0.1 | lib/interactor/organizer.rb |
interactor-2.0.0 | lib/interactor/organizer.rb |