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



15
16
17
18
19
# File 'lib/iso8601/seconds.rb', line 15

def initialize(atom)
  valid_atom?(atom)

  @atom = atom
end

Instance Method Details

#factorNumeric

The Second factor

Returns:

  • (Numeric)


25
26
27
# File 'lib/iso8601/seconds.rb', line 25

def factor
  AVERAGE_FACTOR
end

#symbolSymbol

The atom symbol.

Returns:

  • (Symbol)


41
42
43
# File 'lib/iso8601/seconds.rb', line 41

def symbol
  :S
end

#to_secondsNumeric

The amount of seconds

Returns:

  • (Numeric)


33
34
35
# File 'lib/iso8601/seconds.rb', line 33

def to_seconds
  atom
end