Module: Proxeze::ClassHooks
- Defined in:
- lib/proxeze/class_methods.rb
Instance Method Summary collapse
-
#after(mid, *args, &blk) ⇒ Object
The after hook will receive 3 arguments: target, result, and any arguments to the method that was called.
-
#after_all(*args, &blk) ⇒ Object
The after_all hook will receive 4 arguments: target, result, method id, and any arguments to the method that was called.
-
#before(mid, *args, &blk) ⇒ Object
The before hook will receive 2 arguments: target and any arguments to the method that is being called.
-
#before_all(*args, &blk) ⇒ Object
The before_all hook will receive 3 arguments: target, method id, and any arguments to the method that is being called.
- #hooks ⇒ Object
Instance Method Details
#after(mid, *args, &blk) ⇒ Object
The after hook will receive 3 arguments: target, result, and any arguments to the method that was called.
10 11 12 |
# File 'lib/proxeze/class_methods.rb', line 10 def after mid, *args, &blk insert_into_callback_chain :hook => :after, :mid => mid, :args => args, :blk => blk end |
#after_all(*args, &blk) ⇒ Object
The after_all hook will receive 4 arguments: target, result, method id, and any arguments to the method that was called.
17 18 19 |
# File 'lib/proxeze/class_methods.rb', line 17 def after_all *args, &blk insert_into_callback_chain :hook => :after_all, :blk => blk, :args => args end |
#before(mid, *args, &blk) ⇒ Object
The before hook will receive 2 arguments: target and any arguments to the method that is being called.
24 25 26 |
# File 'lib/proxeze/class_methods.rb', line 24 def before mid, *args, &blk insert_into_callback_chain :hook => :before, :mid => mid, :args => args, :blk => blk end |
#before_all(*args, &blk) ⇒ Object
The before_all hook will receive 3 arguments: target, method id, and any arguments to the method that is being called.
31 32 33 |
# File 'lib/proxeze/class_methods.rb', line 31 def before_all *args, &blk insert_into_callback_chain :hook => :before_all, :blk => blk, :args => args end |
#hooks ⇒ Object
3 4 5 |
# File 'lib/proxeze/class_methods.rb', line 3 def hooks @hooks ||= {:after => {}, :after_all => {}, :before => {}, :before_all => {}} end |