From be7f86e37ac21585ad2621e2e0938c68a7a71360 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 23 Jan 2007 05:32:08 +0000 Subject: Added test coverage for Inflector.inflections.clear. Closes #7179. [Rich Collins]. Remove unused code from Duration#inspect. Closes #7180. [Rich Collins] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6022 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/duration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/duration.rb') diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index 8e518cb00b..5279c4435a 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -55,7 +55,7 @@ module ActiveSupport def inspect #:nodoc: consolidated = parts.inject(Hash.new(0)) { |h,part| h[part.first] += part.last; h } - [:years, :months, :days, :hours, :minutes, :seconds].map do |length| + [:years, :months, :days, :minutes, :seconds].map do |length| n = consolidated[length] "#{n} #{n == 1 ? length.to_s.singularize : length.to_s}" if n.nonzero? end.compact.to_sentence -- cgit v1.2.3