Class: String
Overview
NOTE: this file is not required while running your code the patched classes are used only in tests and tools
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
6 7 8 9 10 11 |
# File 'lib/utils.rb', line 6 def camelize gsub('-', '_').split('_').collect do |word| word[0] = word[0].upcase word end.join end |
#dasherize ⇒ Object
19 20 21 |
# File 'lib/utils.rb', line 19 def dasherize underscore.gsub('_', '-') end |
#underscore ⇒ Object
13 14 15 16 17 |
# File 'lib/utils.rb', line 13 def underscore gsub(/([A-Z]+)([0-9]|[A-Z]|\z)/){"#{$1.capitalize}#{$2}"} .gsub(/(.)([A-Z])/, '\1_\2') .downcase end |