Flowdock
method

singularize

Importance_1
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActiveSupport::Inflector
singularize(word, locale = :en) public

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

If passed an optional locale parameter, the word will be pluralized using rules defined for that language. By default, this parameter is set to :en.

'posts'.singularize            # => "post"
'octopi'.singularize           # => "octopus"
'sheep'.singularize            # => "sheep"
'word'.singularize             # => "word"
'CamelOctopi'.singularize      # => "CamelOctopus"
'leyes'.singularize(:es)       # => "ley"
Show source
Register or log in to add new notes.