Author: Robert Klemme
module Kernel private def this_method_name caller[0] =~ /`([^']*)'/ and $1 end end class Foo def test_method this_method_name end end puts Foo.new.test_method # => test_method
11380 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
module Kernel private def this_method_name caller[0] =~ /`([^']*)'/ and $1 end end class Foo def test_method this_method_name end end puts Foo.new.test_method # => test_method
You need to create an account or log in to post comments to this site.