module CurrentMethodName def current_method_name caller[0][/`([^']*)'/, 1] end end # Example: # # class MyClass # include CurrentMethodName # def test # current_method_name # end # end # # MyClass.new.test # => "test"