Method: Mobility::Util#singularize
- Defined in:
- lib/mobility/util.rb
#singularize(str) ⇒ String
Note:
If singularize is not defined on String, falls back to simply stripping the trailing ‘s’ from the string.
Returns the singular form of a word in a string.
65 66 67 68 69 |
# File 'lib/mobility/util.rb', line 65 def singularize(str) call_or_yield str do str.to_s.gsub(/s$/, '') end end |