class Rcov::CallSiteAnalyzer::CallSite

Object representing a method call site. It corresponds to a part of the callstack starting from the context that called the method.

Public Instance Methods

calling_class(level = 0) click to toggle source

Name of the class holding the method where the call originated. Might return nil if it could not be determined.

# File lib/rcov/call_site_analyzer.rb, line 85
def calling_class(level = 0)
  stack_frame = backtrace[level]
  stack_frame ? stack_frame[0] : nil
end
calling_method(level = 0) click to toggle source

Name of the method where the call originated. Returns nil if the call originated in toplevel. Might return nil if it could not be determined.

# File lib/rcov/call_site_analyzer.rb, line 78
def calling_method(level = 0)
  stack_frame = backtrace[level]
  stack_frame ? stack_frame[1] : nil
end
depth() click to toggle source

whose information is included in the CallSite object.

# File lib/rcov/call_site_analyzer.rb, line 57
def depth
  backtrace.size
end
file(level = 0) click to toggle source

File where the method call originated. Might return nil or "" if it is not meaningful (C extensions, etc).

# File lib/rcov/call_site_analyzer.rb, line 63
def file(level = 0)
  stack_frame = backtrace[level]
  stack_frame ? stack_frame[2] : nil
end
line(level = 0) click to toggle source

Line where the method call originated. Might return nil or 0 if it is not meaningful (C extensions, etc).

# File lib/rcov/call_site_analyzer.rb, line 70
def line(level = 0)
  stack_frame = backtrace[level]
  stack_frame ? stack_frame[3] : nil
end