Class: ISO8601::Days

Inherits:
Object
  • Object
show all
Includes:
Atomic
Defined in:
lib/iso8601/days.rb

Overview

The Days atom in a Duration

A “calendar day” is the time interval which starts at a certain time of day at a certain “calendar day” and ends at the same time of day at the next “calendar day”.

Constant Summary collapse

AVERAGE_FACTOR =
86400

Instance Attribute Summary

Attributes included from Atomic

#atom

Instance Method Summary collapse

Methods included from Atomic

#<=>, #eql?, #hash, #to_f, #to_i, #to_s, #valid_atom?, #valid_base?, #value

Constructor Details

#initialize(atom) ⇒ Days

Returns a new instance of Days.

Parameters:

  • atom (Numeric)

    The atom value



17
18
19
20
21
# File 'lib/iso8601/days.rb', line 17

def initialize(atom)
  valid_atom?(atom)

  @atom = atom
end

Instance Method Details

#factorNumeric

The Day factor

Returns:

  • (Numeric)


27
28
29
# File 'lib/iso8601/days.rb', line 27

def factor
  AVERAGE_FACTOR
end

#symbolSymbol

The atom symbol.

Returns:

  • (Symbol)


43
44
45
# File 'lib/iso8601/days.rb', line 43

def symbol
  :D
end

#to_secondsNumeric

The amount of seconds

Returns:

  • (Numeric)


35
36
37
# File 'lib/iso8601/days.rb', line 35

def to_seconds
  AVERAGE_FACTOR * atom
end