Class: When::CalendarTypes::Christian

Inherits:
TM::Calendar show all
Defined in:
lib/when_exe/region/christian.rb

Overview

Christian Base Calendar

Direct Known Subclasses

Julian, ReformVariation

Constant Summary collapse

DefaultReformDate =

デフォルトの改暦日付(ユリウス通日)

2299161

Constants included from When::Coordinates

When::Coordinates::Bahai, When::Coordinates::Common, When::Coordinates::DefaultDateIndices, When::Coordinates::DefaultDayIndex, When::Coordinates::DefaultTimeIndices, When::Coordinates::Indian, When::Coordinates::Iranian, When::Coordinates::Javanese, When::Coordinates::MATCH, When::Coordinates::Mayan, When::Coordinates::PERIOD, When::Coordinates::PERIOD_NAME, When::Coordinates::PRECISION, When::Coordinates::PRECISION_NAME, When::Coordinates::Tibetan, When::Coordinates::VALUE, When::Coordinates::Yi

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from TM::Calendar

#diff_to_CE, #epoch_in_CE, #reference_frame, #time_basis

Attributes included from TimeStandard::TimeBasis

#_time_basis

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Class Method Summary collapse

Instance Method Summary collapse

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 TimeStandard::TimeBasis

#_normalize_time_basis

Methods included from When::Coordinates

to_deg, to_deg_225, to_dms

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _abbreviation_to_iri, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Class Method Details

._default_start(date) ⇒ Object

::Date オブジェクトに対応する暦法名 (require ‘Date’ されていることの保証は呼び出し側)



50
51
52
53
54
55
56
# File 'lib/when_exe/region/christian.rb', line 50

def self._default_start(date)
  case date.start
  when ::Date::JULIAN    ; 'Julian'
  when ::Date::GREGORIAN ; 'Gregorian'
  else                   ; "Civil?reform_jdn=#{date.start}"
  end
end

Instance Method Details

#_coordinates_to_number(y, m, d) ⇒ Object

年月日 -> 通日



62
63
64
65
66
67
68
# File 'lib/when_exe/region/christian.rb', line 62

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

#_easter_delay(year) ⇒ Object

復活祭の遅延日数



99
100
101
# File 'lib/when_exe/region/christian.rb', line 99

def _easter_delay(year)
  0
end

#_length(date) ⇒ Object

暦要素数

See Also:



89
90
91
92
93
94
# File 'lib/when_exe/region/christian.rb', line 89

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

通日 - > 年月日



74
75
76
77
78
79
80
81
82
83
# File 'lib/when_exe/region/christian.rb', line 74

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