From: Robert Klemme Date: 2006-08-03T18:30:08+09:00 Subject: Re: using the current method name within current method Aleks Kissinger wrote: > Depending on how you feel about mucking with core ruby types, a method > like this one seems like a decent candidate for mixing in to Object. > > class Object > def this_method > caller[0]=~/`(.*?)'/ > $1 > end > end These methods are typically put into Kernel and made private. Also, you don't check whether the RX actually matches. I'd also prefer to change the RX to a more efficient one. So that would give module Kernel private def this_method caller[0] =~ /`([^']*)'/ and $1 end end Kind regards robert