class Class # Converts a class name to a suitable method name # # My::ClassName.method_name => "my__class_name" # # Inspired by facets/core/string/underscore. # def method_name name.gsub(/([A-Z]+)([A-Z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').gsub('::','__').downcase end end # _____ _ # |_ _|__ ___| |_ # | |/ _ \/ __| __| # | | __/\__ \ |_ # |_|\___||___/\__| # =begin test require 'test/unit' class TCClass < Test::Unit::TestCase def test_method_name assert_equal( Test::Unit::TestCase.method_name, 'test__unit__test_case' ) end end =end