instance method
singularize
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
singularize()
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"
Source
# File activesupport/lib/active_support/core_ext/string/inflections.rb, line 41
def singularize
ActiveSupport::Inflector.singularize(self)
end
Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 41
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String