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=en:Christianity, キリスト教]", # 年の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for year=, 年の暦注=, *year]" ], # 月の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for month=, 月の暦注=, *month]", [When::BasicTypes::M17n, "names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, zh:該月的名稱=, *alias:Month=]" ] ], # 日の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for day=, 日の暦注=, *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, Javanese, JulianDay, Mayan, Tibetan, Yis
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
-
#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
#child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#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
#[], #^, _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 Attribute Details
#b ⇒ Integer (readonly)
ベース
669 670 671 |
# File 'lib/when_exe/region/christian.rb', line 669 def b @b end |
#c ⇒ Integer (readonly)
月の位相の補正
661 662 663 |
# File 'lib/when_exe/region/christian.rb', line 661 def c @c end |
#d ⇒ Integer (readonly)
最も遅い満月の3月0日からの日数
645 646 647 |
# File 'lib/when_exe/region/christian.rb', line 645 def d @d end |
#f ⇒ Integer (readonly)
満月補正フラグ
673 674 675 |
# File 'lib/when_exe/region/christian.rb', line 673 def f @f end |
#g ⇒ Integer (readonly)
ガード
665 666 667 |
# File 'lib/when_exe/region/christian.rb', line 665 def g @g end |
#n ⇒ Integer (readonly)
平年数
653 654 655 |
# File 'lib/when_exe/region/christian.rb', line 653 def n @n end |
#s ⇒ Integer (readonly)
置閏周期
657 658 659 |
# File 'lib/when_exe/region/christian.rb', line 657 def s @s end |
#w ⇒ Integer (readonly)
週日補正フラグ
641 642 643 |
# File 'lib/when_exe/region/christian.rb', line 641 def w @w end |
#x ⇒ Integer (readonly)
クリスマスの3月0日からの日数
649 650 651 |
# File 'lib/when_exe/region/christian.rb', line 649 def x @x end |
Instance Method Details
#christmas(date, frame = nil) ⇒ Integer, When::TM::CalDate
クリスマス
695 696 697 698 699 |
# File 'lib/when_exe/region/christian.rb', line 695 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
復活祭
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 |
# File 'lib/when_exe/region/christian.rb', line 710 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?
固定祝日
746 747 748 749 |
# File 'lib/when_exe/region/christian.rb', line 746 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?
移動祝日
759 760 761 762 763 764 |
# File 'lib/when_exe/region/christian.rb', line 759 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
七曜
682 683 684 |
# File 'lib/when_exe/region/christian.rb', line 682 def week(date, base=nil) When.Residue('Week')[date.to_i % 7] end |