method
inspect
v5.1.7 -
Show latest stable
- Class:
ActiveSupport::Duration
inspect()public
No documentation available.
# File activesupport/lib/active_support/duration.rb, line 370
def inspect #:nodoc:
parts.
reduce(::Hash.new(0)) { |h, (l, r)| h[l] += r; h }.
sort_by { |unit, _ | PARTS.index(unit) }.
map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }.
to_sentence(locale: ::I18n.default_locale)
end