Class: When::CalendarTypes::Christian
- Inherits:
-
TM::Calendar
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- TM::Calendar
- When::CalendarTypes::Christian
- Defined in:
- lib/when_exe/region/christian.rb
Overview
Christian Base Calendar
Direct Known Subclasses
Constant Summary
Constants included from When::Coordinates
When::Coordinates::Bahai, When::Coordinates::Chinese, When::Coordinates::Common, When::Coordinates::DefaultDateIndices, When::Coordinates::DefaultDayIndex, When::Coordinates::DefaultTimeIndices, When::Coordinates::Indian, When::Coordinates::Iranian, When::Coordinates::Javanese, When::Coordinates::LocationTable, When::Coordinates::MATCH, When::Coordinates::Mayan, When::Coordinates::PERIOD, When::Coordinates::PERIOD_NAME, When::Coordinates::PRECISION, When::Coordinates::PRECISION_NAME, When::Coordinates::Russian, When::Coordinates::Tibetan, When::Coordinates::VALUE, When::Coordinates::Yi
Constants included from Namespace
Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD
Instance Attribute Summary
Attributes inherited from TM::Calendar
#epoch_in_CE, #reference_frame, #time_basis
Attributes inherited from TM::ReferenceSystem
#domain_of_validity, #position
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#_coordinates_to_number(y, m, d) ⇒ Object
年月日 -> 通日.
-
#_length(date) ⇒ Object
暦要素数.
-
#_number_to_coordinates(jdn) ⇒ Object
通日 - > 年月日.
Methods inherited from TM::Calendar
#_new_month_, _setup_, #_to_month_number_, #date_trans, #jul_trans, #rate_of_clock, #strftime, #time_standard, #to_cal_date, #to_julian_date, #to_universal_time
Methods included from When::Coordinates
Methods inherited from TM::ReferenceSystem
Methods included from Parts::Resource
#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir
Methods included from Parts::Resource::Pool
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Method Details
#_coordinates_to_number(y, m, d) ⇒ Object
年月日 -> 通日
70 71 72 73 74 75 76 |
# File 'lib/when_exe/region/christian.rb', line 70 def _coordinates_to_number(y,m,d) m = (+m + 10) % 12 y = +y + 4716 - m / 10 a = (1461*y.to_i ).div(4) b = ( 153*m.to_i + 2).div(5) return a + b + (+d) - 1401 end |
#_length(date) ⇒ Object
暦要素数
97 98 99 100 101 102 |
# File 'lib/when_exe/region/christian.rb', line 97 def _length(date) yy, mm = date return super unless(mm) return ((yy % 4) == 0) ? 29 : 28 if (mm == 1) return (((((mm + 10) % 12) % 5) % 2) == 0) ? 31 : 30 end |
#_number_to_coordinates(jdn) ⇒ Object
通日 - > 年月日
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/when_exe/region/christian.rb', line 82 def _number_to_coordinates(jdn) j = jdn.to_i + 1401 y, t = (4*j + 3).divmod(1461) t = t.div(4) m, d = (5*t + 2).divmod(153) d = d.div(5) m = (m+2) % 12 y = y - 4716 + (13-m) / 12 return [y,m,d] end |