> Fwd__colon__ [ruby-co45253] [RFC] RubyVM__colon____colon__FrameInfo.caller methodFwd: [ruby-co45253] [RFC] RubyVM::FrameInfo.caller method
> May 28, 2012 From__colon__ ko1__at__a...May 28, 2012 From: ko1@a...
誰からも反応が無く寂しいので,
どなたか考えて下さい....
結局,保守的に倒して,新しいメソッド名を加えた,という感じです.
- ----- Original Message --------
Subject: [ruby-core:45253] [RFC] RubyVM::FrameInfo.caller method
Date: Sat, 26 May 2012 14:07:16 +0900
From: SASADA Koichi <ko1@a...>
Reply-To: ruby-core@r...
To: ruby-core@r...
Hi,
I added a class RubyVM::FrameInfo.caller and methods of it. The
following text is quoted from ChangeLog.
> vm.c (RubyVM__colon____colon__FrameInfo)__colon__ add a class to access each framevm.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.
// SASADA Koichi at atdot dot net