Module: Rpush::Daemon::StringHelpers

Included in:
AppRunner, AppRunner, Synchronizer
Defined in:
lib/rpush/daemon/string_helpers.rb

Instance Method Summary collapse

Instance Method Details

#pluralize(count, singular, plural = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/rpush/daemon/string_helpers.rb', line 4

def pluralize(count, singular, plural = nil)
  if count == 1 || count =~ /^1(\.0+)?$/
    word = singular
  else
    word = plural || singular.pluralize
  end

  "#{count || 0} #{word}"
end