Module: Pacer::Transform::Cap

Defined in:
lib/pacer/transform/cap.rb

Instance Method Summary collapse

Instance Method Details

#help(section = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pacer/transform/cap.rb', line 12

def help(section = nil)
  case section
  when nil
    puts <<HELP
Cap executes the full pipeline until it is empty, discarding all of the
pipeline's results. It then calls getSideEffect from the previous pipe
segment and emits that value as the only resulting value of the route.

The value of getSideEffect is generally calculated by processing each
element of the route. A good example is #count which is actually
implemented as follows:

  r = g.v.counted.cap     #=> #<GraphV -> Obj-Cap(V-Counted)>
  r.to_a                  #=> [123]

In this example, #counted is a side effect pipe. Side effect pipes can
be used on their own but their value is not reliable until the full
pipeline has been processed:

  pipe = g.v.counted.pipe
  pipe.getSideEffect      #=> 0
  pipe.next               #=> #<V[3]>
  pipe.getSideEffect      #=> 1

HELP
  else
    super
  end
  description
end

#with=(route) ⇒ Object



43
44
45
# File 'lib/pacer/transform/cap.rb', line 43

def with=(route)
  @side_effect = route
end