Method: ActiveSupport::Inflector#singularize
- Defined in:
- lib/active_support/inflector/methods.rb
#singularize(word) ⇒ Object
The reverse of pluralize
, returns the singular form of a word in a string.
Examples:
"posts".singularize # => "post"
"octopi".singularize # => "octopus"
"sheep".singularize # => "sheep"
"word".singularize # => "word"
"CamelOctopi".singularize # => "CamelOctopus"
36 37 38 |
# File 'lib/active_support/inflector/methods.rb', line 36 def singularize(word) apply_inflections(word, inflections.singulars) end |