interactor
interactor copied to clipboard
Conditional Organizer
I created some time ago an extension for the Interactor Gem, called "Conditional Organizer"
https://github.com/Engim-eu/interactor-conditional_organizer
it's a super easy extension that allows to do stuff like this
class ExampleConditionalOrganizer
include Interactor::ConditionalOrganizer
def true_method
true
end
def false_method
false
end
organize [{ class: CalledInteractor, if: :true_method },
{ class: NotCalledInteractor, if: :false_method }]
end
The main benefit is to have some logic (that is usually in the interactor) in the organizer, to have a better view of what's going on directly from that
If you find it useful to include in the main gem, I could work to integrate it with a PR