class String

NOTE: this file is not required while running your code the patched classes are used only in tests and tools

Public Instance Methods

camelize() click to toggle source
# File lib/utils.rb, line 6
def camelize
  gsub('-', '_').split('_').collect do |word|
    word[0] = word[0].upcase
    word
  end.join
end
dasherize() click to toggle source
# File lib/utils.rb, line 19
def dasherize
  underscore.gsub('_', '-')
end
underscore() click to toggle source
# 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