Module: BootyCall::Hook::ClassMethods
- Defined in:
- lib/booty_call/hook.rb
Instance Method Summary collapse
- #after(method_id, *args, &block) ⇒ Object
- #before(method_id, *args, &block) ⇒ Object
- #callback(position, method_id, *args, &block) ⇒ Object
- #observe(method_id, &block) ⇒ Object
Instance Method Details
#after(method_id, *args, &block) ⇒ Object
16 17 18 |
# File 'lib/booty_call/hook.rb', line 16 def after(method_id, *args, &block) callback(:after, method_id, *args, &block) end |
#before(method_id, *args, &block) ⇒ Object
12 13 14 |
# File 'lib/booty_call/hook.rb', line 12 def before(method_id, *args, &block) callback(:before, method_id, *args, &block) end |
#callback(position, method_id, *args, &block) ⇒ Object
24 25 26 27 28 |
# File 'lib/booty_call/hook.rb', line 24 def callback(position, method_id, *args, &block) @introspector.defined_methods.include?(method_id) ? @callbacker.send(position, method_id, *args, &block) : observe(method_id) { send(position, method_id, *args, &block) } end |
#observe(method_id, &block) ⇒ Object
20 21 22 |
# File 'lib/booty_call/hook.rb', line 20 def observe(method_id, &block) @introspector.observe(method_id, &block) end |