Class: ISO8601::Hours
Overview
The Hours atom in a Duration
Constant Summary collapse
- AVERAGE_FACTOR =
3600
Instance Attribute Summary
Attributes included from Atomic
Instance Method Summary collapse
-
#factor ⇒ Numeric
The Week factor.
-
#initialize(atom) ⇒ Hours
constructor
A new instance of Hours.
-
#symbol ⇒ Symbol
The atom symbol.
-
#to_seconds ⇒ Numeric
The amount of seconds.
Methods included from Atomic
#<=>, #eql?, #hash, #to_f, #to_i, #to_s, #valid_atom?, #valid_base?, #value
Constructor Details
#initialize(atom) ⇒ Hours
Returns a new instance of Hours.
13 14 15 16 17 |
# File 'lib/iso8601/hours.rb', line 13 def initialize(atom) valid_atom?(atom) @atom = atom end |
Instance Method Details
#factor ⇒ Numeric
The Week factor
23 24 25 |
# File 'lib/iso8601/hours.rb', line 23 def factor AVERAGE_FACTOR end |
#symbol ⇒ Symbol
The atom symbol.
39 40 41 |
# File 'lib/iso8601/hours.rb', line 39 def symbol :H end |
#to_seconds ⇒ Numeric
The amount of seconds
31 32 33 |
# File 'lib/iso8601/hours.rb', line 31 def to_seconds AVERAGE_FACTOR * atom end |