Module Duration::Numeric
In: lib/more/facets/duration.rb

Numeric Extensions for Durations

Methods

day   days   fortnight   fortnights   hour   hours   minute   minutes   month   months   second   seconds   week   weeks   year   years  

Public Instance methods

day()

Alias for days

Converts days into seconds.

[Source]

# File lib/more/facets/duration.rb, line 236
    def days ; Duration[self * 86400] ; end
fortnight()

Alias for fortnights

Converts fortnights into seconds. (A fortnight is 2 weeks)

[Source]

# File lib/more/facets/duration.rb, line 245
    def fortnights ; Duration[self * 1209600] ; end
hour()

Alias for hours

Converts hours into seconds.

[Source]

# File lib/more/facets/duration.rb, line 231
    def hours ; Duration[self * 3600] ; end
minute()

Alias for minutes

Converts minutes into seconds.

[Source]

# File lib/more/facets/duration.rb, line 227
    def minutes ; Duration[self * 60] ; end
month()

Alias for months

Converts months into seconds. WARNING: This is not exact as it assumes 30 days to a month.

[Source]

# File lib/more/facets/duration.rb, line 250
    def months ; Duration[self * 30 * 86400] ; end
second()

Alias for seconds

Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years. The base unit for all of these Numeric time methods is seconds.

[Source]

# File lib/more/facets/duration.rb, line 223
    def seconds ; Duration[self] ; end
week()

Alias for weeks

Converts weeks into seconds.

[Source]

# File lib/more/facets/duration.rb, line 240
    def weeks ; Duration[self * 604800] ; end
year()

Alias for years

Converts years into seconds. WARNING: This is not exact as it assumes 365 days to a year.

         ie. It doesn not account for leap years.

[Source]

# File lib/more/facets/duration.rb, line 256
    def years ; Duration[self * 365 * 86400, :years] ; end

[Validate]