Class: Needle::Pipeline::Collection::BlockElement

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

Overview

Wraps a block as a new pipeline element. When the element is invoked, control is delegated to the block.

Instance Attribute Summary

Attributes inherited from Element

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

Instance Method Summary collapse

Methods inherited from Element

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

Constructor Details

#initialize(point, name, priority, options, block) ⇒ BlockElement

Create a new pipeline element around the given block.



34
35
36
37
# File 'lib/needle/pipeline/collection.rb', line 34

def initialize( point, name, priority, options, block )
  super( point, name, priority, options )
  @block = block
end

Instance Method Details

#call(*args) ⇒ Object

Invoke the block. The block must accept as many parameters as the pipeline expects, plus 1 (the first parameter is always this BlockElement instance).



42
43
44
# File 'lib/needle/pipeline/collection.rb', line 42

def call( *args )
  @block.call( self, *args )
end