From: "Iñaki Baz Castillo" Date: 2009-03-31T08:17:32+09:00 Subject: Re: Getting the current module(s), class name and method in Ruby 1.9 El Martes 31 Marzo 2009, Iñaki Baz Castillo escribió: > Fantastic! Thanks a lot. If somebody is interested, I've implemented the above code adding Class methods logging feature: ---------------- module Kernel def this_method if self.class == Class "#{self.to_s}.#{caller[0][/`(.*)'/, 1]}" else "#{self.class}##{caller[0][/`(.*)'/, 1]}" end end private :this_method end module MM class AA def self.class_method puts this_method end def instance_method puts this_method end end end MM::AA.class_method => "MM::AA.class_method" MM::AA.new.instance_method => "MM::AA#instance_method" ---------------- Regards. -- Iñaki Baz Castillo