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
Post a Comment