Class: ActiveSupport::Duration
- Inherits:
-
Object
- Object
- ActiveSupport::Duration
- Defined in:
- lib/rails_extend/core/duration.rb
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/rails_extend/core/duration.rb', line 3 def inspect return "#{value} #{I18n.t('duration.seconds')}" if @parts.empty? @parts. sort_by { |unit, _ | PARTS.index(unit) }. map { |unit, val| "#{val} #{val == 1 ? I18n.t('duration')[unit] : I18n.t('durations')[unit]}" }. to_sentence(locale: I18n.locale) end |