From: Aleks Kissinger Date: 2006-07-31T13:05:36+09:00 Subject: Re: using the current method name within current method This is kindof a hack, but it seems to work: def get_mname caller[0]=~/`(.*?)'/ # note the first quote is a backtick $1 end def dinosaur puts get_mname end dinosaur() => 'dinosaur' On 7/30/06, Daniel Harple wrote: > On Jul 30, 2006, at 11:37 PM, Matthew Heidemann wrote: > > > Is there a way to get the current method name within the current > > method? > > > > def test_method > > puts self.current_method > > end > > > > --- output ---- > > test_method > > In 1.9 (Ruby CVS HEAD) there is #__method__ and #__callee__: http:// > eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l90 > > -- Daniel > > >