Method: English::Inflect.singular
- Defined in:
- lib/strokedb/util/inflect.rb
.singular(word) ⇒ Object Also known as: singularize
Convert an English word from plurel to singular.
"boys".singular #=> boy
"tomatoes".singular #=> tomato
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/strokedb/util/inflect.rb', line 86 def singular(word) if result = singular_of[word] return result.dup end result = word.dup singularization_rules.each do |(match, replacement)| break if result.gsub!(match, replacement) end return result end |