Module: Hollow::Resource::Chains
- Defined in:
- lib/hollow/resource/chains.rb
Overview
Indicates that a Hollow::Resource class uses chains to perform logic before or after each request.
Instance Method Summary collapse
-
#chain(chain, method, behavior) ⇒ Object
Register a function to invoke before or after a given resource method (or any resource method) is invoked.
Instance Method Details
#chain(chain, method, behavior) ⇒ Object
Register a function to invoke before or after a given resource method (or any resource method) is invoked.
Behaviors are invoked in the order in which they are defined within their respective chains, the exception being that behaviors associated with ‘:all` methods are invoked before more specific methods.
24 25 26 27 |
# File 'lib/hollow/resource/chains.rb', line 24 def chain(chain, method, behavior) (self.class_variable_get(:@@chains)[chain][method] ||= []) << behavior end |