From: dblack@... Date: 2002-11-28T01:58:10+09:00 Subject: Re: The names of a method Hi -- On Thu, 28 Nov 2002, Klaus Fabritius wrote: > Yukihiro Matsumoto wrote: > > on 02/11/27, Klaus Fabritius writes: > > >|Is there a thing like the_name_the_method_was_called_with? > > > > caller(0) may help. > > Thanks to you and Bill. > > I hoped that there is something like local_variables. Well, now it is > the first method in my own utils-package: > > def method_name > /`(.+)'$/.match(caller(1)[0])[1] > end I know it's a longshot, but: dblack@laptop:~/hacking$ cat some\`file def method_name /`(.+)'$/.match(caller(1)[0])[1] end def x puts method_name end x dblack@laptop:~/hacking$ ruby some\`file file:6:in `x dblack@laptop:~/hacking$ I honestly don't know what the perfect tweak would be. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav