Skip to content

Instantly share code, notes, and snippets.

@benstein
Created January 7, 2009 22:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benstein/44477 to your computer and use it in GitHub Desktop.
Save benstein/44477 to your computer and use it in GitHub Desktop.
# Convenient little Rails view helper that does exactly what it says
def pluralize_with_delimiter(count, singular, plural = nil)
pluralize(number_with_delimiter(count), singular, plural)
end
@Overload119
Copy link

Overload119 commented Jul 24, 2022

Nice!

I plopped a Sorbet-enabled version into application_helper.rb

sig {params(count: Numeric, singular: String, plural: T.nilable(String)).returns(String)}
def pluralize_with_delimiter(count, singular, plural = nil)
  ApplicationController.helpers.pluralize(
    ApplicationController.helpers.number_with_delimiter(count),
    singular,
    plural,
  )
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment