Class: Kafo::MultiStageHook

Inherits:
Object
  • Object
show all
Defined in:
lib/kafo/multi_stage_hook.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, registry, types) ⇒ MultiStageHook

Returns a new instance of MultiStageHook.



3
4
5
6
7
8
9
10
11
# File 'lib/kafo/multi_stage_hook.rb', line 3

def initialize(name, registry, types)
  default_name = name

  types.each do |hook_type|
    self.class.send(:define_method, hook_type) do |hook_name = nil, &block|
      registry.send(:register, hook_type, hook_name || default_name, &block)
    end
  end
end