instance method
singularize
Ruby on Rails 3.1.12
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 31
def singularize
ActiveSupport::Inflector.singularize(self)
end
Defined in activesupport/lib/active_support/core_ext/string/inflections.rb line 31
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in String