Active Support Duration

Provides accurate date and time measurements using Date#advance and Time#advance, respectively. It mainly supports the methods on Numeric.

1.month.ago       # equivalent to Time.now.advance(months: -1)

Constants

VARIABLE_PARTS = [:years, :months, :weeks, :days].freeze

PARTS = [:years, :months, :weeks, :days, :hours, :minutes, :seconds].freeze

PARTS_IN_SECONDS = { seconds: 1, minutes: SECONDS_PER_MINUTE, hours: SECONDS_PER_HOUR, days: SECONDS_PER_DAY, weeks: SECONDS_PER_WEEK, months: SECONDS_PER_MONTH, years: SECONDS_PER_YEAR }.freeze

SECONDS_PER_YEAR = 31556952

SECONDS_PER_MONTH = 2629746

SECONDS_PER_WEEK = 604800

SECONDS_PER_DAY = 86400

SECONDS_PER_HOUR = 3600

SECONDS_PER_MINUTE = 60

Attributes

[R] value
Show files where this class is defined (3 files)
Register or log in to add new notes.