module Inflect::Inflector

Constants

SNAKE_SEPARATOR

Public Instance Methods

camelize() click to toggle source
# File lib/inflect/inflector.rb, line 12
def camelize
  word = self.dup
  word.camelize!
end
camelize!() click to toggle source
# File lib/inflect/inflector.rb, line 8
def camelize!
  self.split(SNAKE_SEPARATOR).map(&:capitalize!).join
end
underscore() click to toggle source
# File lib/inflect/inflector.rb, line 24
def underscore
  word = self.dup
  word.underscore!
end
underscore!() click to toggle source
# File lib/inflect/inflector.rb, line 17
def underscore!
  self.gsub!(/(?<=[a-z])[A-Z]/) do |char|
    char = SNAKE_SEPARATOR + char
  end
  self.downcase!
end