Module: Pacer::Transform::Path

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

Instance Method Summary collapse

Instance Method Details

#help(section = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/pacer/transform/path.rb', line 22

def help(section = nil)
  case section
  when nil
    puts <<HELP
Each path returned by this method represents each intermediate value that was
used to calculate the resulting value:

  r = [1,2,3].to_route.map { |n| n*2 }
  p = r.paths                           #=> #<Obj -> Obj-Map -> Path-Path>
  p.to_a                                #=> [[1,1], [2,4], [3,6]]

This is especially useful for graph traversals.

  g.v.out_e.in_v.out_e.in_v.paths.first #=> [#<V[37]>,
                                  #    #<E[41]:37-patcit-38>,
                                  #    #<V[38]>,
                                  #    #<E[40]:38-document-id-39>,
                                  #    #<V[39]>]

See:
  :paths  - for more details and general information about paths.
  :arrays - for general operations that work on arrays or paths.

HELP
  else
    super
  end
  description
end