Class: Proc

Inherits:
Object show all
Defined in:
lib/pretty_debug.rb

Overview

class Module def inspect ans = ancestors.map{|m| “#{m.class.send(:to_s).downcase} #m”}.join(“ < ”) var = (class_variables + instance_variables).join(“, ”) var.empty? ? ans : “#ans#$/#var” end end

Instance Method Summary collapse

Instance Method Details

#inspectObject



128
129
130
131
132
133
# File 'lib/pretty_debug.rb', line 128

def inspect
  f, l = source_location
  "Proc@#{File.basename(f)}:#{l}"
rescue
  "Proc@source_unknown"
end

#source_locationObject



125
126
127
# File 'lib/pretty_debug.rb', line 125

def source_location
  to_s.match(/\A\#\<#{self.class}:.+?@(.+)\:(\d+)(?: \(lambda\))?\>\z/).values_at(1, 2)
end