Class: Needle::Pipeline::InterceptorElement

Inherits:
Element
  • Object
show all
Defined in:
lib/needle/pipeline/interceptor.rb

Overview

The pipeline element that implements adding interceptors to a service.

Instance Attribute Summary collapse

Attributes inherited from Element

#name, #options, #priority, #service_point, #succ

Instance Method Summary collapse

Methods inherited from Element

#<=>, #initialize, #reset!, set_default_priority

Constructor Details

This class inherits a constructor from Needle::Pipeline::Element

Instance Attribute Details

#interceptorsObject (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_elementObject

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