Module: Tddium::TextHelper
- Included in:
- TimeFormat
- Defined in:
- lib/tddium/cli/text_helper.rb
Instance Method Summary collapse
-
#pluralize(count, singular, plural = nil) ⇒ Object
borrowed from rails/ActionView::Helpers.
Instance Method Details
#pluralize(count, singular, plural = nil) ⇒ Object
borrowed from rails/ActionView::Helpers
6 7 8 9 10 11 12 13 14 |
# File 'lib/tddium/cli/text_helper.rb', line 6 def pluralize(count, singular, plural = nil) word = if (count == 1 || count =~ /^1(\.0+)?$/) singular else plural || "#{singular}s" end "#{count || 0} #{word}" end |