Module: Tzu::Hooks::ClassMethods
- Defined in:
- lib/tzu/hooks.rb
Instance Method Summary collapse
- #after(*hooks, &block) ⇒ Object
- #after_hooks ⇒ Object
- #around(*hooks, &block) ⇒ Object
- #around_hooks ⇒ Object
- #before(*hooks, &block) ⇒ Object
- #before_hooks ⇒ Object
Instance Method Details
#after(*hooks, &block) ⇒ Object
16 17 18 19 |
# File 'lib/tzu/hooks.rb', line 16 def after(*hooks, &block) hooks << block if block hooks.each { |hook| after_hooks.push(hook) } end |
#after_hooks ⇒ Object
30 31 32 |
# File 'lib/tzu/hooks.rb', line 30 def after_hooks @after_hooks ||= [] end |
#around(*hooks, &block) ⇒ Object
21 22 23 24 |
# File 'lib/tzu/hooks.rb', line 21 def around(*hooks, &block) hooks << block if block hooks.each { |hook| around_hooks.push(hook) } end |
#around_hooks ⇒ Object
34 35 36 |
# File 'lib/tzu/hooks.rb', line 34 def around_hooks @around_hooks ||= [] end |
#before(*hooks, &block) ⇒ Object
11 12 13 14 |
# File 'lib/tzu/hooks.rb', line 11 def before(*hooks, &block) hooks << block if block hooks.each { |hook| before_hooks.push(hook) } end |
#before_hooks ⇒ Object
26 27 28 |
# File 'lib/tzu/hooks.rb', line 26 def before_hooks @before_hooks ||= [] end |