module Pipetree::Inspect
Public Instance Methods
inspect(options={ style: :line })
click to toggle source
TODO: implement for nested TODO: remove in Representable::Debug.
# File lib/pipetree/inspect.rb, line 4 def inspect(options={ style: :line }) names = each_with_index.collect do |func, i| [i, inspect_func(func)] end return inspect_line(names) if options[:style] == :line inspect_rows(names) end
inspect_func(func)
click to toggle source
# File lib/pipetree/inspect.rb, line 13 def inspect_func(func) func end
inspect_line(names)
click to toggle source
# File lib/pipetree/inspect.rb, line 17 def inspect_line(names) string = names.collect { |i, name| "#{name}" }.join("|>") "[#{string}]" end
inspect_row(index, name)
click to toggle source
# File lib/pipetree/inspect.rb, line 32 def inspect_row(index, name) "#{index}|>#{name}" end
inspect_rows(names)
click to toggle source
# File lib/pipetree/inspect.rb, line 22 def inspect_rows(names) string = names.collect do |i, name| index = sprintf("%2d", i) inspect_row(index, name) end.join("\n") # name = sprintf("%-60.300s", name) # no idea what i'm doing here. # "#{index}) #{name} #{func.source_location.join(":")}" "\n#{string}" end