Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #11855 from dchelimsky/chop-is-faster

Use chop instead of singularize in Duration#inspect
  • Loading branch information...
commit f948814b44e56643381f49ef0567fb44148f4efe 2 parents adf3b5b + 908c039
@rafaelfranca rafaelfranca authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activesupport/lib/active_support/duration.rb
View
2  activesupport/lib/active_support/duration.rb
@@ -73,7 +73,7 @@ def inspect #:nodoc:
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)
Please sign in to comment.
Something went wrong with that request. Please try again.