Class: Pacer::Transform::Payload::PayloadPipe
- Inherits:
-
Pipes::RubyPipe
- Object
- AbstractPipe
- Pipes::RubyPipe
- Pacer::Transform::Payload::PayloadPipe
- Defined in:
- lib/pacer/transform/payload.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#wrapper ⇒ Object
readonly
Returns the value of attribute wrapper.
Attributes inherited from Pipes::RubyPipe
Instance Method Summary collapse
- #getPathToHere ⇒ Object
-
#initialize(route, block) ⇒ PayloadPipe
constructor
A new instance of PayloadPipe.
- #processNextStart ⇒ Object
Methods inherited from Pipes::RubyPipe
#enablePath, #reset, #setStarts
Constructor Details
#initialize(route, block) ⇒ PayloadPipe
Returns a new instance of PayloadPipe.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pacer/transform/payload.rb', line 24 def initialize(route, block) super() if route.element_type == :edge @wrapper = Pacer::Payload::Edge elsif route.element_type == :vertex @wrapper = Pacer::Payload::Vertex else fail Pacer::ClientError, 'Can not use PayloadPipe on non-element data' end block ||= proc { |el| nil } @block = Pacer::Wrappers::WrappingPipeFunction.new route, block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
22 23 24 |
# File 'lib/pacer/transform/payload.rb', line 22 def block @block end |
#wrapper ⇒ Object (readonly)
Returns the value of attribute wrapper.
22 23 24 |
# File 'lib/pacer/transform/payload.rb', line 22 def wrapper @wrapper end |
Instance Method Details
#getPathToHere ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/pacer/transform/payload.rb', line 42 def getPathToHere path = super i = path.size - 1 path.remove path.size - 1 if i >= 0 path.add currentEnd path end |
#processNextStart ⇒ Object
37 38 39 40 |
# File 'lib/pacer/transform/payload.rb', line 37 def processNextStart el = starts.next @wrapper.new el, block.call(el) end |