Class: ISO8601::Months

Inherits:
Atom
  • Object
show all
Defined in:
lib/iso8601/atoms.rb

Overview

A Months atom in a Duration

A “calendar month” is the time interval resulting from the division of a “calendar year” in 12 time intervals.

A “duration month” is the duration of 28, 29, 30 or 31 “calendar days” depending on the start and/or the end of the corresponding time interval within the specific “calendar month”.

Instance Attribute Summary

Attributes inherited from Atom

#atom, #base

Instance Method Summary collapse

Methods inherited from Atom

#<=>, #eql?, #hash, #initialize, #to_f, #to_i, #to_s, #to_seconds, #value

Constructor Details

This class inherits a constructor from ISO8601::Atom

Instance Method Details

#factorObject

The Month factor

The “duration month” average is calculated through time intervals of 400 “duration years”. Each cycle of 400 “duration years” has 303 “common years” of 365 “calendar days” and 97 “leap years” of 366 “calendar days”.


159
160
161
162
163
164
165
166
167
# File 'lib/iso8601/atoms.rb', line 159

def factor
  if base.nil?
    nobase_calculation
  elsif atom.zero?
    zero_calculation
  else
    calculation
  end
end

#symbolSymbol

The atom symbol.


173
174
175
# File 'lib/iso8601/atoms.rb', line 173

def symbol
  :M
end