Class: ISO8601::Seconds

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

Overview

The Seconds atom in a Duration

The second is the base unit of measurement of time in the International System of Units (SI) as defined by the International Committee of Weights and Measures.

Constant Summary collapse

AVERAGE_FACTOR =
1

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) ⇒ Seconds

Returns a new instance of Seconds.

Parameters:

  • atom (Numeric)

    The atom value



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

def initialize(atom)
  valid_atom?(atom)

  @atom = atom
end

Instance Method Details

#factorNumeric

The Second factor

Returns:

  • (Numeric)


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

def factor
  AVERAGE_FACTOR
end

#symbolSymbol

The atom symbol.

Returns:

  • (Symbol)


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

def symbol
  :S
end

#to_secondsNumeric

The amount of seconds

Returns:

  • (Numeric)


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

def to_seconds
  atom
end