Project

General

Profile

Actions

Feature #6646

closed

Objectified caller

Feature #6646: Objectified caller

Added by trans (Thomas Sawyer) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-core:45852]

Description

In Feature #3917 it is mentioned short-coming of caller:

  • caller() returns an array of "filename:linenum in `method'" string.
    User must parse it and retrieve filename and linenum by rexp.
    It is also very heavy weight task.

I think many have wished for objectified trace.

caller[0].file
caller[0].line
caller[0].in

Different method would be needed than #caller though to prevent backward compatibility issue.

Updated by ko1 (Koichi Sasada) over 13 years ago Actions #1 [ruby-core:45860]

is [ruby-core:45693] not enough?

loc = caller_locations[0]
loc#label # #in
loc#lineno # #line
loc#path # #file

Updated by trans (Thomas Sawyer) over 13 years ago Actions #2 [ruby-core:45861]

Yep! And Yeah!

Updated by matz (Yukihiro Matsumoto) over 13 years ago Actions #3 [ruby-core:45874]

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom