From: Thomas Thomassen Date: 2012-11-12T05:46:41+09:00 Subject: Re: using the current method name within current method 7stud -- wrote in post #1083904: >> Using caller does give me the name of the calling method, but there is >> no reference to what module or class that method belonged to. Is that >> possible to obtain? > > def get_mname > caller[0]=~/`(.*?)'/ # note the first quote is a backtick > $1 > end > > def dinosaur > puts get_mname > puts method(get_mname).owner > end > > dinosaur > > --output:-- > dinosaur > Object There is no Method#owner in Ruby 1.8.6. And I don't understand how it would have worked anyway - determining the class/method a method belongs to given just a string with the method name? If you have two classes, Foo and Bar - each each method #biz - how would method('biz').owner returned the correct caller? -- Posted via http://www.ruby-forum.com/.