Module: Innate::Helper::Aspect::SingletonMethods
- Includes:
- Traited
- Defined in:
- lib/innate/helper/aspect.rb
Overview
Module containing various methods that will be made available as class methods to the class that included Innate::Helper::Aspect.
Instance Method Summary collapse
- #add_action_wrapper(order, method_name) ⇒ Object
-
#after(*names, &block) ⇒ Object
Hook that is called after a specific list of actions.
-
#after_all(&block) ⇒ Object
Hook that is called after all the actions in a node.
-
#before(*names, &block) ⇒ Object
Hook that is called before a specific list of actions.
-
#before_all(&block) ⇒ Object
Hook that is called before all the actions in a node.
-
#wrap(*names, &block) ⇒ Object
Wraps the block around the list of actions resulting in the block being called both before and after each action.
Methods included from Traited
#ancestral_trait, #ancestral_trait_values, #class_trait, #each_ancestral_trait, included, #trait
Instance Method Details
#add_action_wrapper(order, method_name) ⇒ Object
278 279 280 281 282 283 284 |
# File 'lib/innate/helper/aspect.rb', line 278 def add_action_wrapper(order, method_name) if wrap = trait[:wrap] wrap.merge(SortedSet[[order, method_name.to_s]]) else trait :wrap => SortedSet[[order, method_name.to_s]] end end |
#after(*names, &block) ⇒ Object
Hook that is called after a specific list of actions.
244 245 246 |
# File 'lib/innate/helper/aspect.rb', line 244 def after(*names, &block) names.each{|name| AOP[self][:after][name] = block } end |
#after_all(&block) ⇒ Object
Hook that is called after all the actions in a node.
216 217 218 |
# File 'lib/innate/helper/aspect.rb', line 216 def after_all(&block) AOP[self][:after_all] = block end |
#before(*names, &block) ⇒ Object
Hook that is called before a specific list of actions.
192 193 194 |
# File 'lib/innate/helper/aspect.rb', line 192 def before(*names, &block) names.each{|name| AOP[self][:before][name] = block } end |
#before_all(&block) ⇒ Object
Hook that is called before all the actions in a node.
164 165 166 |
# File 'lib/innate/helper/aspect.rb', line 164 def before_all(&block) AOP[self][:before_all] = block end |
#wrap(*names, &block) ⇒ Object
Wraps the block around the list of actions resulting in the block being called both before and after each action.
273 274 275 276 |
# File 'lib/innate/helper/aspect.rb', line 273 def wrap(*names, &block) before(*names, &block) after(*names, &block) end |