3 ms·
I didn't see it mentioned, but, btw, this code allows a method to introspect to figure out what the method name that's currently being executed. caller[0][/`([
by iamwil 17y ago
I didn't see it mentioned, but, btw, this code allows a method to introspect to figure out what the method name that's currently being executed.
caller[0][/`([^']*)'/, 1]
Note that you only need to do this for Ruby 1.8. In Ruby 1.9, there will be a __method__() and __callee__() method that does the same thing.