Module: Gogetit::ExecutionHooks
- Defined in:
- lib/executionhooks.rb
Instance Method Summary collapse
-
#before_hook(method_name) ⇒ Object
this is the DSL method that classes use to add before hooks.
-
#hooks ⇒ Object
keeps track of all before hooks.
-
#method_added(method_name) ⇒ Object
this method is invoked whenever a new instance method is added to a class.
Instance Method Details
#before_hook(method_name) ⇒ Object
this is the DSL method that classes use to add before hooks
13 14 15 |
# File 'lib/executionhooks.rb', line 13 def before_hook(method_name) hooks << method_name end |
#hooks ⇒ Object
keeps track of all before hooks
18 19 20 |
# File 'lib/executionhooks.rb', line 18 def hooks @hooks ||= [] end |
#method_added(method_name) ⇒ Object
this method is invoked whenever a new instance method is added to a class
5 6 7 8 9 10 |
# File 'lib/executionhooks.rb', line 5 def method_added(method_name) # do nothing if the method that was added was an actual hook method, or # if it already had hooks added to it return if hooks.include?(method_name) || hooked_methods.include?(method_name) add_hooks_to(method_name) end |