class ParentInteractor
include Interactor
end
class ChildInteractor < ParentInteractor
end
ParentInteractor.before do
puts "Before in parent"
end
ChildInteractor.call
=> "Before in parent"
I had to move around the internals of the Hooks module a bit to make this work, which might break things, should people attempt to mutate the values of #around_hooks, #before_hooks and #after_hooks in their applications. I hope this is acceptable if we target this fix for the next major version, which seems to be 4.0.
This PR implements support for inheriting hooks defined in ancestors.
A previous PR has also targeted this issue; however, that solution does not support hooks declared in ancestors at runtime. This solution does:
I had to move around the internals of the
Hooks
module a bit to make this work, which might break things, should people attempt to mutate the values of#around_hooks
,#before_hooks
and#after_hooks
in their applications. I hope this is acceptable if we target this fix for the next major version, which seems to be 4.0.Let me know if I'm missing anything.
Fixes: #114