Displaying 1 result from an estimated 1 matches for "singularize2".
Did you mean:
singularize
2006 Sep 05
1
Inflector::pluralize("Agencies")=="Agency" ?
...ese 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/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subsc...