Verb Pluralization Helper

August 17, 2006

I haven’t posted much lately — sorry about that! There are only 20 days left to the private beta launch of my application and there is an amazing amount of work to be done. I did, however, want to share a cool little helper for pluralizing verbs (which pluralize() does not do):

  def pluralize_verb(count, singular, plural = nil)
    verbs = { 'has' => 'have', 'was' => 'were', 'is' => 'are' }
    if count == 1
      singular
    elsif plural
      plural
    elsif verbs[singular]
      verbs[singular]
    else
      singular
    end
  end

Leave a Reply