struct

ActiveSupport::Duration

Inherits Struct < Value < Object

Constants

PART_ORDER = {:years, :months, :weeks, :days, :hours, :minutes, :seconds}
SECONDS_PER_PART = { seconds: 1_i64, minutes: 60_i64, hours: 3600_i64, days: 86400_i64, weeks: 604800_i64, months: 2592000_i64, years: 31536000_i64, }

Constructors

new(parts : Array(Tuple(Symbol, Int64)))
Source
new(*parts : Tuple(Symbol, Int64))
Source

Class methods

name_part(part : Symbol, n : Int64) : String
Source
normalize(parts) : Array(Tuple(Symbol, Int64))
Source

Instance methods

!=(other : Duration) : Bool
Source
+(other : Duration) : Duration
Source
-(other : Duration) : Duration
Source
==(other : Duration) : Bool
Source
==(other : Int) : Bool
Source
add_to(time : Time, sign : Int32 = 1) : Time
Source
calendar_months
Source
fixed_seconds
Source
from_now
Source
in_milliseconds
Source
inspect

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

This method should usually not be overridden. It delegates to #inspect(IO) which can be overridden for custom implementations.

Also see #to_s.

Source
part_value(part : Symbol) : Int64

Sums of specific parts.

Source
parts
since
Source
to_i
Source
to_s

Rails inspect format: "2 days", "2 days and 6 hours", "1 day, 2 hours and 3 minutes".

Source
to_span
Source
until
Source
value