Class: When::CalendarNote::Christian
- Inherits:
-
When::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarNote
- When::CalendarNote::Christian
- Defined in:
- lib/when_exe/region/christian.rb
Overview
キリスト教の暦注(クリスマスと復活祭)
Constant Summary collapse
- Notes =
[When::BasicTypes::M17n, [ "locale:[=en:, ja=ja:, alias]", "names:[Christian]", # 年の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[year]" ], # 月の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[month]", [When::BasicTypes::M17n, "names:[Month]" ] ], # 日の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[day]", [When::BasicTypes::M17n, "names:[Week, 七曜]" ], [When::BasicTypes::M17n, "names:[Easter, 復活祭]" ], [When::BasicTypes::M17n, "names:[Christmas, クリスマス]"], [When::BasicTypes::M17n, "names:[Fixed_feast=, 固定祝日=]" ], [When::BasicTypes::M17n, "names:[Moveable_feast, 移動祝日]" ] ] ]]
- Fixed_feasts =
固定祝日
{ [ 1, 6] => "Epiphany", [ 3, 1] => "St.David's Day", [ 3, 17] => "St.Patrick's Day", [ 3, 25] => "Annunciation-Lady Day", [ 4, 23] => "St.George's Day", [ 6, 24] => "Midsummer Day", [ 9, 14] => "Holy Cross Day", [ 9, 29] => "Michaelmas Day", [11, 30] => "St.Andrew's Day", [12, 13] => "St.Lucia's Day", [12, 21] => "St.Thomas's Day", # [12, 25] => "Christmas Day" }
- Moveable_feasts =
移動祝日
{ # 復活祭からの日数による -63 => "Septuagesima Sunday", -56 => "Sexagesima Sunday", -49 => "Quinquagesima Sunday", -46 => "Ash Wednesday", -42 => "Quadragesima Sunday", -40 => "I Quatember", -35 => "Reminizer Sunday", -28 => "Oculi Sunday", -21 => "Laetare Sunday", -14 => "Judica Sunday", -7 => "Palmarum", -2 => "Good Friday", # 0 => "Easter Day", 7 => "Low Sunday", 35 => "Rogation Sunday", 39 => "Ascension Day", 49 => "Whitsunday", 53 => "II Quatember", 56 => "Trinity Sunday", 60 => "Corpus Christi", }.update(moveable_feasts)
- CalendarDepend =
暦法によってイベントの動作を変えるか否か
true
Constants inherited from When::CalendarNote
Bahai, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, HashProperty, Javanese, JulianDay, Mayan, Tibetan, Yis
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
Instance Attribute Summary collapse
-
#b ⇒ Integer
readonly
ベース.
-
#c ⇒ Integer
readonly
月の位相の補正.
-
#d ⇒ Integer
readonly
最も遅い満月の3月0日からの日数.
-
#f ⇒ Integer
readonly
満月補正フラグ.
-
#g ⇒ Integer
readonly
ガード.
-
#n ⇒ Integer
readonly
平年数.
-
#s ⇒ Integer
readonly
置閏周期.
-
#w ⇒ Integer
readonly
週日補正フラグ.
-
#x ⇒ Integer
readonly
クリスマスの3月0日からの日数.
Attributes inherited from When::CalendarNote
Attributes inherited from TM::ReferenceSystem
#domain_of_validity, #position
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#_delta(parameter = nil) ⇒ Object
(also: #christmas_delta, #easter_delta)
イベントの標準的な間隔を返す.
-
#christmas(date, frame = nil) ⇒ Integer, When::TM::CalDate
クリスマス.
-
#easter(date, frame = nil) ⇒ Integer, When::TM::CalDate
復活祭.
-
#fixed_feast(date, frame = nil) ⇒ String?
固定祝日.
-
#moveable_feast(date, frame = nil) ⇒ String?
移動祝日.
-
#week(date, base = nil) ⇒ When::Coordinates::Residue
七曜.
Methods inherited from When::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
Methods inherited from TM::ReferenceSystem
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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Attribute Details
#b ⇒ Integer (readonly)
ベース
663 664 665 |
# File 'lib/when_exe/region/christian.rb', line 663 def b @b end |
#c ⇒ Integer (readonly)
月の位相の補正
655 656 657 |
# File 'lib/when_exe/region/christian.rb', line 655 def c @c end |
#d ⇒ Integer (readonly)
最も遅い満月の3月0日からの日数
639 640 641 |
# File 'lib/when_exe/region/christian.rb', line 639 def d @d end |
#f ⇒ Integer (readonly)
満月補正フラグ
667 668 669 |
# File 'lib/when_exe/region/christian.rb', line 667 def f @f end |
#g ⇒ Integer (readonly)
ガード
659 660 661 |
# File 'lib/when_exe/region/christian.rb', line 659 def g @g end |
#n ⇒ Integer (readonly)
平年数
647 648 649 |
# File 'lib/when_exe/region/christian.rb', line 647 def n @n end |
#s ⇒ Integer (readonly)
置閏周期
651 652 653 |
# File 'lib/when_exe/region/christian.rb', line 651 def s @s end |
#w ⇒ Integer (readonly)
週日補正フラグ
635 636 637 |
# File 'lib/when_exe/region/christian.rb', line 635 def w @w end |
#x ⇒ Integer (readonly)
クリスマスの3月0日からの日数
643 644 645 |
# File 'lib/when_exe/region/christian.rb', line 643 def x @x end |
Instance Method Details
#_delta(parameter = nil) ⇒ Object Also known as: christmas_delta, easter_delta
イベントの標準的な間隔を返す
722 723 724 |
# File 'lib/when_exe/region/christian.rb', line 722 def _delta(parameter=nil) return When::P1Y end |
#christmas(date, frame = nil) ⇒ Integer, When::TM::CalDate
クリスマス
689 690 691 692 693 |
# File 'lib/when_exe/region/christian.rb', line 689 def christmas(date, frame=nil) _event(date, 'christmas', frame) do |year, frame| @x - 1 + frame._coordinates_to_number(year, 2, 0) end end |
#easter(date, frame = nil) ⇒ Integer, When::TM::CalDate
復活祭
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'lib/when_exe/region/christian.rb', line 704 def easter(date, frame=nil) _event(date, 'easter', frame) do |year, frame| golden = (year+@b) % @s + 1 m = (frame._lunar_equation(year) + 11*golden + @c) % 30 if @f == 0 m += 1 if m==0 || m==1 && golden>=@n else m += (golden-1) / @f m -= 30 if m>=@n end result = frame._coordinates_to_number(year, 2, 0) + @d - 1 - m result += @g - (result-@w) % 7 if @w<7 result + frame._easter_delay(year) end end |
#fixed_feast(date, frame = nil) ⇒ String?
固定祝日
740 741 742 743 |
# File 'lib/when_exe/region/christian.rb', line 740 def fixed_feast(date, frame=nil) date = When.Calendar(frame||'Gregorian') ^ date unless date.frame.kind_of?(When::CalendarTypes::Christian) Fixed_feasts[date.cal_date[-2..-1]] end |
#moveable_feast(date, frame = nil) ⇒ String?
移動祝日
753 754 755 756 757 758 |
# File 'lib/when_exe/region/christian.rb', line 753 def moveable_feast(date, frame=nil) result = Moveable_feasts[date.to_i - easter(date, frame).to_i] return result if result date = When.Calendar(frame||'Gregorian') ^ date unless date.frame.kind_of?(When::CalendarTypes::Christian) Moveable_feasts[date.cal_date[-2..-1] + [date.to_i % 7]] end |
#week(date, base = nil) ⇒ When::Coordinates::Residue
七曜
676 677 678 |
# File 'lib/when_exe/region/christian.rb', line 676 def week(date, base=nil) When.Residue('Week')[date.to_i % 7] end |