From: uncutstone wu Date: 2006-05-18T02:42:12+09:00 Subject: Re: Method name Dave Burt wrote: > Mark Volkmann wrote: >> name = caller(0).first.split.last >> >> This gives it to you with single quotes around it which you may want >> to strip off. > > Does this work? > > def __FUNCTION__ > caller(1).first[/ `(.*)'\Z/, 1] > end > > Cheers, > Dave What if I am at the outmost level? I cannot get a function name , just got something like this: test.rb:2546 It may not be a perfect solution. -- Posted via http://www.ruby-forum.com/.