Method: String#singularize

Defined in:
lib/active_support/core_ext/string/inflections.rb

#singularizeObject

The reverse of pluralize, returns the singular form of a word in a string.

"posts".singularize            # => "post"
"octopi".singularize           # => "octopus"
"sheep".singularize            # => "sheep"
"word".singularize             # => "word"
"the blue mailmen".singularize # => "the blue mailman"
"CamelOctopi".singularize      # => "CamelOctopus"


31
32
33
# File 'lib/active_support/core_ext/string/inflections.rb', line 31

def singularize
  ActiveSupport::Inflector.singularize(self)
end