Class: Needle::Pipeline::InterceptorElement
- Defined in:
- lib/needle/pipeline/interceptor.rb
Overview
The pipeline element that implements adding interceptors to a service.
Instance Attribute Summary collapse
-
#interceptors ⇒ Object
readonly
The array of interceptors to be proxied onto the object.
Attributes inherited from Element
#name, #options, #priority, #service_point, #succ
Instance Method Summary collapse
-
#call(container, point, *args) ⇒ Object
Invokes the next element in the chain and adds the interceptors to the result, returning a proxy object wrapped by the interceptors.
-
#initialize_element ⇒ Object
Initializes the array of interceptors.
Methods inherited from Element
#<=>, #initialize, #reset!, set_default_priority
Constructor Details
This class inherits a constructor from Needle::Pipeline::Element
Instance Attribute Details
#interceptors ⇒ Object (readonly)
The array of interceptors to be proxied onto the object.
29 30 31 |
# File 'lib/needle/pipeline/interceptor.rb', line 29 def interceptors @interceptors end |
Instance Method Details
#call(container, point, *args) ⇒ Object
Invokes the next element in the chain and adds the interceptors to the result, returning a proxy object wrapped by the interceptors.
38 39 40 41 |
# File 'lib/needle/pipeline/interceptor.rb', line 38 def call( container, point, *args ) service = succ.call( container, point, *args ) InterceptorChainBuilder.build( point, service, @interceptors ) end |
#initialize_element ⇒ Object
Initializes the array of interceptors. It is initially empty.
32 33 34 |
# File 'lib/needle/pipeline/interceptor.rb', line 32 def initialize_element @interceptors = [] end |