Ruby: a nice way to get name of current method you're in:
This is a nice extension to get the name of the method you’re currently in (Ruby < 1.9)
[ruby]
module Kernel
private
def this_method
caller[0] =~ /`([^’]*)’/ and $1
end
end
[/ruby]
for Ruby >= 1.9 you can uses this:
[ruby]
module Kernel
private
def this_method
method
end
end
[/ruby]
[see Stack Over Flow as well]