Class: DateTime::AllLeap

Inherits:
DateTimeLike show all
Extended by:
DateTimeLikeExtension
Defined in:
lib/timesteps/datetime_allleap.rb,
lib/timesteps/datetime_timestep.rb

Overview

datetime class represents ‘allleap` or `366_day` calendar

Constant Summary collapse

DPY =

Number of days per year

366
DPM =

Numbers of days per months

[0,31,29,31,30,31,30,31,31,30,31,30,31]
UNIX_EPOCH_IN_AJD =

Astronomical Julian day number of UNIX epoch

Rational(4891223,2)

Instance Attribute Summary

Attributes inherited from DateTimeLike

#day, #hour, #minute, #month, #offset, #year

Instance Method Summary collapse

Methods inherited from DateTimeLike

#+, #-, #<<, #<=>, #>>, #ajd, #compare_d, #compare_md, #difference_in_months, #difference_in_years, #fraction, #initialize, #inspect, #jd, #new_offset, #next_day, #next_month, #next_year, #prev_day, #prev_month, #prev_year, #second, #second_fraction, #strftime, #succ, #to_s, #wday, #yday

Constructor Details

This class inherits a constructor from DateTimeLike

Instance Method Details

#leap?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/timesteps/datetime_allleap.rb', line 28

def leap?
  true
end

#timeperiod(interval_spec, tz: nil, ends: "[]") ⇒ Object



76
77
78
# File 'lib/timesteps/datetime_timestep.rb', line 76

def timeperiod (interval_spec, tz: nil, ends: "[]")
  return TimePeriod.new(interval_spec, since: self, calendar: "allleap", ends: ends, tz: tz)
end

#timestep(interval_spec, tz: nil) ⇒ Object



72
73
74
# File 'lib/timesteps/datetime_timestep.rb', line 72

def timestep (interval_spec, tz: nil)
  return TimeStep.new(interval_spec, since: self, clanedar: "allleap", tz: tz)
end