Class: Pacer::Pipes::LoopPipe

Inherits:
RubyPipe
  • Object
show all
Defined in:
lib/pacer/pipe/loop_pipe.rb

Constant Summary collapse

BlueprintsGraph =
com.tinkerpop.blueprints.Graph

Instance Attribute Summary

Attributes inherited from RubyPipe

#starts

Instance Method Summary collapse

Methods inherited from RubyPipe

#reset

Constructor Details

#initialize(graph, looping_pipe, control_block) ⇒ LoopPipe

Returns a new instance of LoopPipe.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pacer/pipe/loop_pipe.rb', line 6

def initialize(graph, looping_pipe, control_block)
  super()
  @graph = graph
  @control_block = control_block
  @wrapper = Pacer::Wrappers::WrapperSelector.build graph

  @expando = ExpandablePipe.new
  looping_pipe.setStarts(@expando)
  if control_block.arity < 0 or control_block.arity > 2
    @yield_paths = true
    looping_pipe.enablePath true
  end
  @looping_pipe = looping_pipe
end

Instance Method Details

#enablePath(b) ⇒ Object



32
33
34
35
# File 'lib/pacer/pipe/loop_pipe.rb', line 32

def enablePath(b)
  super
  looping_pipe.enablePath true if b and not yield_paths
end

#nextObject



21
22
23
24
25
# File 'lib/pacer/pipe/loop_pipe.rb', line 21

def next
  super
ensure
  @path = next_path
end

#setStarts(starts) ⇒ Object



27
28
29
30
# File 'lib/pacer/pipe/loop_pipe.rb', line 27

def setStarts(starts)
  super
  enablePath true if yield_paths
end