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”.



137
138
139
140
141
142
143
144
145
# File 'lib/iso8601/atoms.rb', line 137

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

#symbolSymbol

The atom symbol.

Returns:

  • (Symbol)


150
151
152
# File 'lib/iso8601/atoms.rb', line 150

def symbol
  :M
end