Writing some ruby code (not rails) and I need to handle something like this:
found 1 match
found 2 matches
I have rails installed so maybe I might be able to add a require clause at the top of the script, but does anyone know of a RUBY method that pluralizes strings? Is there a class I can require that can deal with this if the script isn't rails but I have rails installed?
Thanks in advance!
Edit: All of these answers were close but I checked off the one that got it working for me. Try this method as a helper when writing ruby (not rails) code:
def pluralize(number, text)
return text.pluralize if number != 1
text
end
Hope that helps!