module BusinessPipeline::Hooks::ClassMethods

Public Instance Methods

add_hooks(*new_hooks, type: __callee__, &block) click to toggle source
# File lib/business_pipeline/hooks.rb, line 12
def add_hooks(*new_hooks, type: __callee__, &block)
  hooks[type] += [*new_hooks, block].compact.map do |hook|
    hook.respond_to?(:new) ? hook.new : hook
  end
end
Also aliased as: after, around, before
after(*new_hooks, type: __callee__, &block)
Alias for: add_hooks
around(*new_hooks, type: __callee__, &block)
Alias for: add_hooks
before(*new_hooks, type: __callee__, &block)
Alias for: add_hooks
hooks() click to toggle source
# File lib/business_pipeline/hooks.rb, line 21
def hooks
  @hooks ||= { after: [], around: [], before: [] }
end