Class: When::CalendarTypes::Civil

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

Overview

Civil Calendar

Constant Summary

Constants inherited from Christian

When::CalendarTypes::Christian::DefaultReformDate

Constants inherited from TM::Calendar

TM::Calendar::HashProperty

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 Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

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 collapse

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

Instance Method Summary collapse

Methods inherited from Gregorian

#_century_from_jdn, #_diff_from_century

Methods inherited from Christian

_default_start

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, utf_gets

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, #parent, #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

Instance Attribute Details

#reform_jdnInteger (readonly) Also known as: _default_start

改暦日付

Returns:

  • (Integer)


362
363
364
# File 'lib/when_exe/region/christian.rb', line 362

def reform_jdn
  @reform_jdn
end

Instance Method Details

#_coordinates_to_number(y, m, d) ⇒ Object

年月日 -> 通日



385
386
387
388
389
390
# File 'lib/when_exe/region/christian.rb', line 385

def _coordinates_to_number(y,m,d)
  skip, limit = @the_length[[y,m]]
  d += skip if skip && d >= limit
  jdn  = @new._coordinates_to_number(y,m,d)
  jdn >= @reform_jdn ? jdn :  @old._coordinates_to_number(y + @origin_of_MSC - @old.origin_of_MSC, m, d)
end

#_easter_delay(year) ⇒ Object

復活祭の遅延日数



434
435
436
# File 'lib/when_exe/region/christian.rb', line 434

def _easter_delay(year)
  @old._easter_delay(year)
end

#_length(date) ⇒ Object

暦要素数

See Also:



412
413
414
415
416
417
418
419
# File 'lib/when_exe/region/christian.rb', line 412

def _length(date)
  return @the_length[date][2] if @the_length[date]
  yy, mm = date
  (yy >  @reform_date[0]) ||
  (yy == @reform_date[0] && (!mm || mm >= @reform_date[1])) ?
    @new._length(date) :
    @old._length([yy + @origin_of_MSC - @old.origin_of_MSC, mm])
end

#_lunar_equation(year) ⇒ Integer

Note:

太陽暦日の補正も、本メソッドで行う

太陰方程式

Parameters:

  • year (Numeric)

    西暦の年数

Returns:

  • (Integer)

    19年7閏のペースに対する満月の日付の補正量



427
428
429
# File 'lib/when_exe/region/christian.rb', line 427

def _lunar_equation(year)
  year >= @the_easter ? @new._lunar_equation(year) : @old._lunar_equation(year)
end

#_number_to_coordinates(jdn) ⇒ Object

通日 - > 年月日



396
397
398
399
400
401
402
403
404
405
406
# File 'lib/when_exe/region/christian.rb', line 396

def _number_to_coordinates(jdn)
  if jdn >= @reform_jdn
    date     = @new._number_to_coordinates(jdn)
  else
    date     = @old._number_to_coordinates(jdn)
    date[0] -= @origin_of_MSC - @old.origin_of_MSC
  end
  skip, limit = @the_length[date[0..-2]]
  date[2] -= skip if skip && date[2] >= limit
  date
end

#first_year_of_borderInteger

年初の最初の定義の年

Returns:

  • (Integer)

    年初の最初の定義の年

  • nil



375
376
377
378
379
# File 'lib/when_exe/region/christian.rb', line 375

def first_year_of_border
  return nil unless @border.kind_of?(When::Coordinates::MultiBorder)
  year = @border.borders[-1][:key]
  year.kind_of?(Integer) ? year : nil
end