module Representable::Pipeline::Debug

Public Instance Methods

_inspect_function(func) click to toggle source

prints SkipParse instead of <Proc>. i know, i can make this better, but not now.

# File lib/representable/debug.rb, line 78
def _inspect_function(func)
  return func.extend(Pipeline::Debug).inspect if func.is_a?(Collect)
  return func unless func.is_a?(Proc)

  File.readlines(func.source_location[0])[func.source_location[1]-1].match(/^\s+(\w+)/)[1]
end
call(input, options) click to toggle source
Calls superclass method
# File lib/representable/debug.rb, line 55
def call(input, options)
  Debug.representable_log "Pipeline#call: #{inspect}"
  Debug.representable_log "               input: #{input.inspect}"
  super
end
evaluate(block, memo, options) click to toggle source
Calls superclass method
# File lib/representable/debug.rb, line 61
def evaluate(block, memo, options)
  block.extend(Pipeline::Debug) if block.is_a?(Collect)

  Debug.representable_log "  Pipeline   :   -> #{_inspect_function(block)} "
  super.tap do |res|
    Debug.representable_log "  Pipeline   :     result: #{res.inspect}"
  end
end
inspect() click to toggle source
# File lib/representable/debug.rb, line 70
def inspect
  functions = collect do |func|
    _inspect_function(func)
  end.join(", ")
  "#{self.class.to_s.split("::").last}[#{functions}]"
end