Method: MotionSupport::Inflector#singularize
- Defined in:
- motion/inflector/methods.rb
#singularize(word) ⇒ Object
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"
'CamelOctopi'.singularize # => "CamelOctopus"
28 29 30 |
# File 'motion/inflector/methods.rb', line 28 def singularize(word) apply_inflections(word, inflections.singulars) end |