Slide 68
Slide 68 text
def caller_method(depth = 1)
parse_caller(caller(depth+1).first).last
end
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = Regexp.last_match[1]
line = Regexp.last_match[2].to_i
method = Regexp.last_match[3]
[file, line, method]
end
Monday, November 7, 11