ruby - How to get the name of the calling method? -


is there way in ruby find calling method name inside of method?

for example:

class test   def self.foo     fooz.bar   end end  class fooz   def self.bar     # test.foo or foo   end end 

puts caller[0] 

or perhaps...

puts caller[0][/`.*'/][1..-2] 

Comments

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -