aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/duration.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-12 10:30:42 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-08-12 10:30:42 -0700
commitf948814b44e56643381f49ef0567fb44148f4efe (patch)
tree6a6c949c0092a023f6840baefbc0d2b56bad59c2 /activesupport/lib/active_support/duration.rb
parentadf3b5b79b75973b947eed37314e15274857c1a3 (diff)
parent908c0392796b945efb8c82fde5a4844788446ece (diff)
downloadrails-f948814b44e56643381f49ef0567fb44148f4efe.tar.gz
rails-f948814b44e56643381f49ef0567fb44148f4efe.tar.bz2
rails-f948814b44e56643381f49ef0567fb44148f4efe.zip
Merge pull request #11855 from dchelimsky/chop-is-faster
Use chop instead of singularize in Duration#inspect
Diffstat (limited to 'activesupport/lib/active_support/duration.rb')
-rw-r--r--activesupport/lib/active_support/duration.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb
index 2cb1f408b6..f7b12a1db6 100644
--- a/activesupport/lib/active_support/duration.rb
+++ b/activesupport/lib/active_support/duration.rb
@@ -73,7 +73,7 @@ module ActiveSupport
consolidated = parts.inject(::Hash.new(0)) { |h,(l,r)| h[l] += r; h }
parts = [:years, :months, :days, :minutes, :seconds].map do |length|
n = consolidated[length]
- "#{n} #{n == 1 ? length.to_s.singularize : length.to_s}" if n.nonzero?
+ "#{n} #{n == 1 ? length.to_s.chop : length.to_s}" if n.nonzero?
end.compact
parts = ["0 seconds"] if parts.empty?
parts.to_sentence(:locale => :en)