Class: String
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
12 13 14 |
# File 'lib/attrio/core_ext/string.rb', line 12 def camelize self.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join end |
#underscore ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/attrio/core_ext/string.rb', line 4 def underscore self.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |