Displaying 1 result from an estimated 1 matches for "pluralize2".
Did you mean:
pluralize
2006 Sep 05
1
Inflector::pluralize("Agencies")=="Agency" ?
...t it to one or the other regardless of it already being so.
Anyway, I''ve written these which seem to work. Do they already exist
somewhere ?
def is_plural?(astring)
Inflector::singularize(astring)!=astring
end
def is_singular?(astring)
Inflector::singularize(astring)==astring
end
def pluralize2(astring)
is_singular?(astring) ? Inflector::pluralize(astring) : astring
end
def singularize2(astring)
is_plural?(astring) ? Inflector::singularize(astring) : astring
end
magpie
"Just Enough Software Quality":http://jesq.blogspot.com
--
Posted via http://www.ruby-forum.com/.
--~--~...