Class: String
Instance Method Summary collapse
-
#methodize ⇒ Object
From the Facets package.
-
#modulize ⇒ Object
From the Facets package.
Instance Method Details
#methodize ⇒ Object
From the Facets package.
Changes a module name in a method compatible name.
99 100 101 |
# File 'lib/ruby_ext.rb', line 99 def methodize to_s.gsub(/([A-Z])/, '_\1').downcase.gsub(/^_/,'').gsub(/(::|\/)_?/, '__') end |
#modulize ⇒ Object
From the Facets package.
Changes a method name in a module compatible name.
106 107 108 |
# File 'lib/ruby_ext.rb', line 106 def modulize to_s.gsub(/(__|\/)(.?)/){ "::" + $2.upcase }.gsub(/(^|_)(.)/){ $2.upcase } end |