Module: Pipetree::Flow::Inspect
Defined Under Namespace
Classes: Proc
Instance Method Summary
collapse
Methods included from Inspect
#inspect, #inspect_object, #inspect_proc
Instance Method Details
#inspect_func(step) ⇒ Object
8
9
10
11
|
# File 'lib/pipetree/flow/inspect.rb', line 8
def inspect_func(step)
cfg = @step2proc[step]
[cfg.name || super(cfg.proc), cfg.operator]
end
|
#inspect_line(names) ⇒ Object
13
14
15
16
|
# File 'lib/pipetree/flow/inspect.rb', line 13
def inspect_line(names)
string = names.collect { |i, name| "#{name.last}#{name.first}" }.join(",")
"[#{string}]"
end
|
#inspect_row(index, name) ⇒ Object
18
19
20
|
# File 'lib/pipetree/flow/inspect.rb', line 18
def inspect_row(index, name)
"#{index} #{name.last}#{name.first}"
end
|
#inspect_rows(names) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/pipetree/flow/inspect.rb', line 22
def inspect_rows(names)
string = names.collect do |i, (name, operator)|
op = "#{operator}#{name}"
padding = 38
proc = if operator == "<"
sprintf("%- #{padding}s", op)
elsif [">", ">>", "&"].include?(operator.to_s)
sprintf("% #{padding}s", op)
else
pad = " " * ((padding - op.length) / 2)
"#{pad}#{op}#{pad}"
end
proc = proc.gsub(" ", "=")
sprintf("%2d %s", i, proc)
end.join("\n")
"\n#{string}"
end
|