Method: Module#call_site

Defined in:
lib/spy_on.rb

#call_site(depth = 1) ⇒ Object



25
26
27
28
29
# File 'lib/spy_on.rb', line 25

def call_site(depth=1)
  paths = caller(2).map { |path| path =~ /\(eval\)/ ? path : File.expand_path(path).sub(/#{File.expand_path Dir.pwd}/, '.') }
  our = paths.reject { |path| path =~ /vendor.rails|rubygems/ }
  return ["#{our.first} via "] + paths.first(depth)
end