Module: Pipetree::Railway::Inspect
- Includes:
- Inspect
- Defined in:
- lib/pipetree/railway/inspect.rb
Constant Summary collapse
Instance Method Summary collapse
Methods included from Inspect
Instance Method Details
#inspect_func(step) ⇒ Object
6 7 8 |
# File 'lib/pipetree/railway/inspect.rb', line 6 def inspect_func(step) @inspect[step] end |
#inspect_line(names) ⇒ Object
12 13 14 15 |
# File 'lib/pipetree/railway/inspect.rb', line 12 def inspect_line(names) string = names.collect { |i, (track, name)| "#{Operator[track]}#{name}" }.join(",") "[#{string}]" end |
#inspect_rows(names) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pipetree/railway/inspect.rb', line 17 def inspect_rows(names) string = names.collect do |i, (track, name)| operator = Operator[track] 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 |