From: SASADA Koichi Date: 2012-05-26T14:07:16+09:00 Subject: [ruby-core:45253] [RFC] RubyVM::FrameInfo.caller method Hi, I added a class RubyVM::FrameInfo.caller and methods of it. The following text is quoted from ChangeLog. > * vm.c (RubyVM::FrameInfo): add a class to access each frame > information. You don't need to parse strings from caller(). > FrameInfo has the following methods: > FrameInfo#name: method name, class name, etc with decorations. > FrameInfo#basename: name without decorations. > FrameInfo#line_no: line number. > FrameInfo#filename: file name. > FrameInfo#filepath: full filepath. > FrameInfo#iseq: iseq if it is iseq frame (defined by ruby script) > FrameInfo#to_s: return caller() method style string. > RubyVM::FrameInfo.caller(n, lev) returns array of FrameInfo objects. > The name "RubyVM::FrameInfo.caller" is long and ambiguous (it is > confusing with Kernel::caller() method), we need to change the name > before Ruby 2.0 release. Good names or comments are welcome. I think it is strange a bit that the singleton method of the FrameInfo class returns a collection (array) of FrameInfo objects. And the name `caller()' is confusing with Kernel.caller(). Any good name? Or any comment of this new feature? BTW, I added second argument of Kernel::caller(). You can specify required array size with it. For example, caller(0, 1) returns only 1 frame (the current frame which calls caller() method) information string. # ... and performance is also improved. -- // SASADA Koichi at atdot dot net