Module: Tzu::Hooks::ClassMethods

Defined in:
lib/tzu/hooks.rb

Instance Method Summary collapse

Instance Method Details

#after(*hooks, &block) ⇒ Object



17
18
19
20
# File 'lib/tzu/hooks.rb', line 17

def after(*hooks, &block)
  hooks << block if block
  hooks.each { |hook| after_hooks.push(hook) }
end

#after_hooksObject



31
32
33
# File 'lib/tzu/hooks.rb', line 31

def after_hooks
  @after_hooks ||= []
end

#around(*hooks, &block) ⇒ Object



22
23
24
25
# File 'lib/tzu/hooks.rb', line 22

def around(*hooks, &block)
  hooks << block if block
  hooks.each { |hook| around_hooks.push(hook) }
end

#around_hooksObject



35
36
37
# File 'lib/tzu/hooks.rb', line 35

def around_hooks
  @around_hooks ||= []
end

#before(*hooks, &block) ⇒ Object



12
13
14
15
# File 'lib/tzu/hooks.rb', line 12

def before(*hooks, &block)
  hooks << block if block
  hooks.each { |hook| before_hooks.push(hook) }
end

#before_hooksObject



27
28
29
# File 'lib/tzu/hooks.rb', line 27

def before_hooks
  @before_hooks ||= []
end