when_exe 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +210 -171
  3. data/bin/irb.rc +1 -0
  4. data/lib/when_exe.rb +78 -53
  5. data/lib/when_exe/basictypes.rb +27 -8
  6. data/lib/when_exe/calendarnote.rb +848 -805
  7. data/lib/when_exe/calendartypes.rb +110 -240
  8. data/lib/when_exe/coordinates.rb +2440 -2175
  9. data/lib/when_exe/core/compatibility.rb +1 -1
  10. data/lib/when_exe/core/duration.rb +13 -11
  11. data/lib/when_exe/core/extension.rb +38 -45
  12. data/lib/when_exe/ephemeris.rb +43 -14
  13. data/lib/when_exe/ephemeris/eclipse.rb +149 -0
  14. data/lib/when_exe/ephemeris/notes.rb +39 -7
  15. data/lib/when_exe/icalendar.rb +2 -6
  16. data/lib/when_exe/inspect.rb +1408 -1399
  17. data/lib/when_exe/parts/enumerator.rb +486 -477
  18. data/lib/when_exe/parts/resource.rb +1101 -1069
  19. data/lib/when_exe/parts/timezone.rb +6 -5
  20. data/lib/when_exe/region/babylonian.rb +405 -405
  21. data/lib/when_exe/region/bahai.rb +21 -61
  22. data/lib/when_exe/region/chinese/epochs.rb +81 -81
  23. data/lib/when_exe/region/chinese/twins.rb +51 -51
  24. data/lib/when_exe/region/christian.rb +7 -2
  25. data/lib/when_exe/region/coptic.rb +1 -1
  26. data/lib/when_exe/region/discordian.rb +9 -16
  27. data/lib/when_exe/region/french.rb +1 -1
  28. data/lib/when_exe/region/hanke_henry.rb +57 -0
  29. data/lib/when_exe/region/indian.rb +41 -73
  30. data/lib/when_exe/region/international_fixed.rb +97 -0
  31. data/lib/when_exe/region/iranian.rb +203 -203
  32. data/lib/when_exe/region/japanese.rb +13 -13
  33. data/lib/when_exe/region/japanese/eclipses.rb +1194 -0
  34. data/lib/when_exe/region/japanese/notes.rb +1482 -1383
  35. data/lib/when_exe/region/japanese/residues.rb +726 -721
  36. data/lib/when_exe/region/japanese/twins.rb +37 -37
  37. data/lib/when_exe/region/jewish.rb +2 -2
  38. data/lib/when_exe/region/pax.rb +60 -0
  39. data/lib/when_exe/region/positivist.rb +100 -0
  40. data/lib/when_exe/region/roman.rb +333 -334
  41. data/lib/when_exe/region/shire.rb +3 -20
  42. data/lib/when_exe/region/thai.rb +2 -2
  43. data/lib/when_exe/region/tibetan.rb +3 -3
  44. data/lib/when_exe/region/tranquility.rb +208 -0
  45. data/lib/when_exe/region/vanishing_leprechaun.rb +53 -0
  46. data/lib/when_exe/region/vietnamese.rb +4 -4
  47. data/lib/when_exe/region/world.rb +9 -13
  48. data/lib/when_exe/region/world_season.rb +89 -0
  49. data/lib/when_exe/region/zoroastrian.rb +4 -2
  50. data/lib/when_exe/tmobjects.rb +14 -4
  51. data/lib/when_exe/tmposition.rb +239 -81
  52. data/lib/when_exe/tmreference.rb +57 -28
  53. data/lib/when_exe/version.rb +1 -1
  54. data/link_to_online_documents +6 -3
  55. data/test/examples/today.rb +1 -1
  56. data/test/scripts.rb +23 -0
  57. data/test/scripts/2.ext.rb +169 -0
  58. data/test/scripts/2.rb +169 -0
  59. data/test/scripts/3.ext.rb +133 -0
  60. data/test/scripts/3.rb +134 -0
  61. data/test/scripts/4.ext.rb +112 -0
  62. data/test/scripts/4.min.rb +65 -0
  63. data/test/scripts/4.rb +136 -0
  64. data/test/scripts/5.ext.rb +78 -0
  65. data/test/scripts/5.rb +81 -0
  66. data/test/scripts/6.gcal.rb +131 -0
  67. data/test/scripts/6.rb +205 -0
  68. data/test/scripts/6.tz.rb +105 -0
  69. data/test/scripts/7.phase.rb +109 -0
  70. data/test/scripts/7.rb +95 -0
  71. data/test/scripts/7.term.rb +128 -0
  72. data/test/scripts/7.week.rb +84 -0
  73. data/test/scripts/8.ext.rb +61 -0
  74. data/test/scripts/8.rb +62 -0
  75. data/test/scripts/9.ext.rb +131 -0
  76. data/test/scripts/9.rb +130 -0
  77. data/test/scripts/chinese-luni-solar.rb +52 -0
  78. data/test/{examples → scripts}/geometric_complex.rb +41 -41
  79. data/test/scripts/geometric_complex.txt +18 -0
  80. data/test/scripts/korea.rb +59 -0
  81. data/test/scripts/thai-reviewed.txt +211 -0
  82. data/test/scripts/thai.rb +36 -0
  83. data/test/scripts/thai.txt +210 -0
  84. data/test/test.rb +7 -0
  85. data/test/test/basictypes.rb +22 -0
  86. data/test/test/coordinates.rb +2 -1
  87. data/test/test/ephemeris.rb +34 -2
  88. data/test/test/icalendar.rb +12 -0
  89. data/test/test/inspect.rb +37 -1
  90. data/test/test/parts.rb +4 -3
  91. data/test/test/region/armenian.rb +20 -0
  92. data/test/test/region/bahai.rb +58 -0
  93. data/test/test/region/chinese.rb +14 -3
  94. data/test/test/region/christian.rb +16 -35
  95. data/test/test/region/discordian.rb +20 -0
  96. data/test/test/region/indian.rb +30 -2
  97. data/test/test/region/japanese.rb +24 -0
  98. data/test/test/region/jewish.rb +2 -0
  99. data/test/test/region/m17n.rb +9 -0
  100. data/test/test/region/reforms.rb +121 -0
  101. data/test/test/region/residue.rb +17 -11
  102. data/test/test/region/shire.rb +58 -0
  103. data/test/test/region/swedish.rb +45 -0
  104. data/test/test/region/zoroastrian.rb +58 -0
  105. data/test/test/tmobjects.rb +74 -0
  106. data/test/test/tmposition.rb +468 -397
  107. data/when_exe.gemspec +2 -2
  108. metadata +49 -6
@@ -180,7 +180,7 @@ module When
180
180
  #
181
181
  # @private
182
182
  def _to_date_for_note(date)
183
- date = When::ShireG ^ date unless date.frame.label.to_s == 'Shire'
183
+ date = When::Shire ^ date unless date.frame.label.to_s == 'Shire'
184
184
  date
185
185
  end
186
186
 
@@ -209,32 +209,15 @@ module When
209
209
  'label' => 'Shire::Shire',
210
210
  'indices' => _shire_indices,
211
211
  'border' => '00-00-02',
212
+ 'engine_day' => -9, # Jun 1st is 01-09
212
213
  'day_offset' => -183, # the day 183 days before summer solstice
213
214
  'cycle_offset' => Rational(1,4), # summer solstice
214
- 'time_basis' => '+09:00', # JST
215
+ # 'time_basis' => '+09:00', # JST
215
216
  'rule_table' => {
216
217
  365 => {'Length'=>[2]+[30]*6+[3]+[30]*6, 'IDs'=>_IDs},
217
218
  366 => {'Length'=>[2]+[30]*6+[4]+[30]*6, 'IDs'=>_IDs}
218
219
  },
219
220
  'note' => 'ShireWeek'
220
221
  }]
221
-
222
- #
223
- # Shire Calendar based on Gregorian Date
224
- #
225
- ShireG = [CyclicTableBased, {
226
- 'label' => 'Shire::Shire',
227
- 'origin_of_LSC' => 1721060-10,
228
- 'indices' => _shire_indices,
229
- 'border' => '00-00-02',
230
- 'rule_table' => {
231
- 'T' => {'Rule' =>['LC', 'SC', 'SC', 'SC']},
232
- 'SC' => {'Rule' =>[365]*4 + [366, 365, 365, 365]*24},
233
- 'LC' => {'Rule' =>[366, 365, 365, 365]*25},
234
- 365 => {'Length'=>[2]+[30]*6+[3]+[30]*6, 'IDs'=>_IDs},
235
- 366 => {'Length'=>[2]+[30]*6+[4]+[30]*6, 'IDs'=>_IDs}
236
- },
237
- 'note' => 'ShireWeek'
238
- }]
239
222
  end
240
223
  end
@@ -226,13 +226,13 @@ module When
226
226
  def _normalize(args=[], options={})
227
227
  @origin_of_LSC ||= 2392666
228
228
  @origin_of_MSC ||= 1201
229
- @epoch_in_CE ||= 1839
229
+ @epoch_in_CE ||= 638
230
230
  @before = @after = 'ThaiC'
231
231
  @indices ||= ThaiP::Indices
232
232
  pattern ||= Pattern.dup
233
233
  if @patch
234
234
  @patch.scan(/(\d+)([ABC])/i) do |year,type|
235
- pattern[year.to_i-@epoch_in_CE] = type.upcase
235
+ pattern[year.to_i-(@origin_of_MSC+@epoch_in_CE)] = type.upcase
236
236
  end
237
237
  end
238
238
  @rule_table = {
@@ -170,9 +170,9 @@ module When
170
170
  When.Index('Tibetan::Month', {:branch=>{0=>intercalary_month[0], 1=>intercalary_month[1]}, :shift=>2}),
171
171
  When.Index({:branch=>{-2=>intercalary_day[0], +1=>intercalary_day[1]}})
172
172
  ]
173
- @label ||= 'Tibetan::Tibetan'
174
- @epoch_in_CE ||= 0
175
- @type ||= 1
173
+ @label ||= 'Tibetan::Tibetan'
174
+ @diff_to_CE ||= 0
175
+ @type ||= 1
176
176
  @parameter = case @type.to_i
177
177
  when 1
178
178
  {'M0'=>(60+15),
@@ -0,0 +1,208 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ module When
9
+
10
+ class BasicTypes::M17n
11
+
12
+ Tranquility = [self, [
13
+ "locale:[=en:, ja=ja:, alias]",
14
+ "names:[Tranquility=]",
15
+ "[Tranquility=en:Tranquility_Calendar, 静かの海の暦=]",
16
+
17
+ [self,
18
+ "names:[IntercalaryDay=en:Intercalation, 閏日=ja:%%<閏>]",
19
+ "[%0sAldrin Day=, %0s閏日=]"
20
+ ]
21
+ ]]
22
+ end
23
+
24
+ #
25
+ # Tranquility Week
26
+ #
27
+ class CalendarNote::TranquilityWeek < CalendarNote::Week
28
+
29
+ #
30
+ # Tranquility Note
31
+ #
32
+ Notes = [When::BasicTypes::M17n, [
33
+ "locale:[=en:, ja=ja:, alias]",
34
+ "names:[Tranquility]",
35
+
36
+ # Notes for year ----------------------------
37
+ [When::BasicTypes::M17n,
38
+ "names:[year]"
39
+ ],
40
+
41
+ # Notes for month ----------------------------
42
+ [When::BasicTypes::M17n,
43
+ "names:[month]",
44
+ [When::BasicTypes::M17n,
45
+ "names:[Month]",
46
+ "[Archimedes, アルキメデス ]",
47
+ "[Brahe=en:Tycho_Brahe, ブラーエ=ja:%%<ティコ・ブラーエ> ]",
48
+ "[Copernicus=en:Nicolaus_Copernicus, コペルニクス=ja:%%<ニコラウス・コペルニクス> ]",
49
+ "[Darwin=en:Charles_Darwin, ダーウィン=ja:%%<チャールズ・ダーウィン> ]",
50
+ "[Einstein=en:Albert_Einstein, アインシュタイン=ja:%%<アルベルト・アインシュタイン> ]",
51
+ "[Faraday=en:Michael_Faraday, ファラデー=ja:%%<マイケル・ファラデー> ]",
52
+ "[Galileo=en:Galileo_Galilei, ガリレオ=ja:%%<ガリレオ・ガリレイ> ]",
53
+ "[Hippocrates, ヒポクラテス ]",
54
+ "[Imhotep, イムホテプ ]",
55
+ "[Jung=en:Carl_Jung, ユング=ja:%%<カール・グスタフ・ユング> ]",
56
+ "[Kepler=en:Johannes_Kepler, ケプラー=ja:%%<ヨハネス・ケプラー> ]",
57
+ "[Lavoisier=en:Antoine_Lavoisier, ラヴォアジエ=ja:%%<アントワーヌ・ラヴォアジエ> ]",
58
+ "[Mendel=en:Gregor_Mendel, メンデル=ja:%%<グレゴール・ヨハン・メンデル> ]"
59
+ ]
60
+ ],
61
+
62
+ # Notes for day ----------------------------
63
+ [When::BasicTypes::M17n,
64
+ "names:[day]",
65
+ [When::BasicTypes::M17n,
66
+ "names:[Week]",
67
+ [DayOfWeek, "label:[Friday, 金曜日, /date/day_names/5]", {'delta'=> 7}],
68
+ [DayOfWeek, "label:[Saturday, 土曜日, /date/day_names/6]", {'delta'=> 7}],
69
+ [DayOfWeek, "label:[Sunday, 日曜日, /date/day_names/0]", {'delta'=> 7}],
70
+ [DayOfWeek, "label:[Monday, 月曜日, /date/day_names/1]", {'delta'=> 7}],
71
+ [DayOfWeek, "label:[Tuesday, 火曜日, /date/day_names/2]", {'delta'=> 7}],
72
+ [DayOfWeek, "label:[Wednesday, 水曜日, /date/day_names/3]", {'delta'=> 7}],
73
+ [DayOfWeek, "label:[Thursday, 木曜日, /date/day_names/4]", {'delta'=> 7}],
74
+ [DayOfWeek, "label:[Armstrong Day=en:Neil_Armstrong, アームストロングの日=ja:%%<ニール・アームストロング>]", {'delta'=> 366}],
75
+ [DayOfWeek, "label:[Aldrin Day=en:Buzz_Aldrin, オルドリンの日=ja:%%<バズ・オルドリン>]", {'delta'=>1461}]
76
+ ],
77
+
78
+ "[Common_Week]"
79
+ ]
80
+ ]]
81
+
82
+ # @private
83
+ IndexOfWeek = [0, 1, 2, 3, 4, 5, 7, nil, 6]
84
+
85
+ # Just or last friday
86
+ #
87
+ # @param [When::TM::TemporalPosition] date
88
+ # @param [nil] parameter (not used)
89
+ #
90
+ # @return [When::TM::TemporalPosition]
91
+ #
92
+ def friday(date, parameter=nil)
93
+ date = _to_date_for_note(date)
94
+ y,m,d = date.cal_date
95
+ dow = (+d-1) % 7
96
+ if date.length(When::MONTH) == 29 && +d >= 28
97
+ dow = (m == 8) ? (d*1 == 27 ? 6 : 7) :
98
+ (d == 28 ? 6 : 7)
99
+ end
100
+ date -= When::P1D * dow unless dow == 0
101
+ date.events = [@days_of_week[0]]
102
+ date
103
+ end
104
+
105
+ #
106
+ # What day is it the specified date?
107
+ #
108
+ # @param [When::TM::TemporalPosition] date
109
+ # @param [When::TM::CalDate] base
110
+ #
111
+ # @return [Hash<:value=>When::CalendarNote::Week::DayOfWeek, :position=>Array<Integer>>]
112
+ #
113
+ def week(date, base=nil)
114
+ date = _to_date_for_note(date)
115
+ y,m,d = date.cal_date
116
+ dow = d*0 == 0 ? (d<=28 ? (d-1) % 7 : d-22) : 8
117
+ length = (base||date).length(When::MONTH) - 21
118
+ index = (length == 7 || m == 13) ? dow : IndexOfWeek[dow]
119
+ {:value=>@days_of_week[dow], :position=>[index, length]}
120
+ end
121
+
122
+ #
123
+ # Week labels
124
+ #
125
+ # @param [When::TM::TemporalPosition] date
126
+ #
127
+ # @return [Array<When::CalendarNote::Week::DayOfWeek>]
128
+ #
129
+ def week_labels(date)
130
+ date = _to_date_for_note(date)
131
+ date.length(When::MONTH) == 28 ? @days_of_week.child[0...7] :
132
+ date.month == 13 ? @days_of_week.child[0...8] :
133
+ @days_of_week.child[0...6] + [@days_of_week.child[8], @days_of_week.child[6]]
134
+ end
135
+
136
+ #
137
+ # convert any date to Tranquility calendar date
138
+ #
139
+ # @private
140
+ def _to_date_for_note(date)
141
+ date = When::Tranquility ^ date unless date.frame.equal?(When::Tranquility)
142
+ date
143
+ end
144
+
145
+ private
146
+
147
+ # Normalization fo object
148
+ # @private
149
+ def _normalize(args=[], options={})
150
+ @event ||= 'friday'
151
+ super
152
+ end
153
+ end
154
+
155
+ module CalendarTypes
156
+
157
+ #
158
+ # Tranquility calendar based on Gregorian calendar
159
+ #
160
+ class Tranquility < YearLengthTableBased
161
+
162
+ # @private
163
+ Normal_IDS = (1..28).to_a
164
+
165
+ # @private
166
+ Long_IDS = (1..29).to_a
167
+
168
+ # @private
169
+ Leap_IDS = (1..27).to_a + [When.Pair(27,1), 28]
170
+
171
+ private
172
+
173
+ #
174
+ # Object Normalization
175
+ #
176
+ def _normalize(args=[], options={})
177
+ @label ||= 'Tranquility::Tranquility'
178
+ @indices ||= [
179
+ When.Index('TranquilityWeekNotes::month::Month', {:unit =>13}),
180
+ When.Index({:branch=>{1=>When.M17n('Tranquility::IntercalaryDay')[0]}})
181
+ ]
182
+ @origin_of_MSC ||= -1968
183
+ @diff_to_CE ||= 0
184
+ @engine_month ||= 7
185
+ @engine_day ||= 21
186
+ @note ||= 'TranquilityWeek'
187
+ @rule_table ||= {
188
+ 365 => {'Length'=>[28]*12 + [29]},
189
+ 366 => {'Length'=>[28]* 7 + [29] + [28]*4 + [29]}
190
+ }
191
+ super
192
+ end
193
+
194
+ #
195
+ # day arrangement pattern
196
+ #
197
+ def _ids_(date)
198
+ y, m = date
199
+ case m
200
+ when nil ; super
201
+ when 12 ; Long_IDS
202
+ when 7 ; @engine._length([+y + 1, 1]) == 28 ? Normal_IDS : Leap_IDS
203
+ else ; Normal_IDS
204
+ end
205
+ end
206
+ end
207
+ end
208
+ end
@@ -0,0 +1,53 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ module When
9
+
10
+ class BasicTypes::M17n
11
+
12
+ VanishingLeprechaun = [self, [
13
+ "locale:[=en:, ja]",
14
+ "names:[VanishingLeprechaun=http://suchowan.at.webry.info/201110/article_12.html, 消える小妖精=]"
15
+ ]]
16
+ end
17
+
18
+ module CalendarTypes
19
+
20
+ class VanishingLeprechaun < EphemerisBased
21
+
22
+ # 月初の通日
23
+ #
24
+ # @param [Integer] m 通月
25
+ #
26
+ # @return [Integer] 月初の通日
27
+ #
28
+ def _new_month_(m)
29
+ div, mod = m.divmod(@cycle_months)
30
+ div * @cycle_days + @offset_table[m % @cycle_months] + @origin_of_LSC
31
+ end
32
+
33
+ private
34
+
35
+ #
36
+ # Object Normalization
37
+ #
38
+ def _normalize(args=[], options={})
39
+ @label ||= 'VanishingLeprechaun::VanishingLeprechaun'
40
+ @origin_of_LSC ||= -372154
41
+ @origin_of_MSC ||= -5731
42
+ @epoch_in_CE ||= 0
43
+ _normal = [31] * 5 + [30] * 7
44
+ _leap = [31] * 6 + [30] * 6
45
+ _length_table = ((_normal * 3 + _leap) * 4 + _normal + ((_normal * 3 + _leap) * 4)) * 53 + [30]
46
+ @offset_table = _length_table.inject([0]) {|sum,len| sum << (sum.last + len)}
47
+ @cycle_days = @offset_table.pop
48
+ @cycle_months = @offset_table.length
49
+ super
50
+ end
51
+ end
52
+ end
53
+ end
@@ -225,11 +225,11 @@ module When
225
225
  "locale:[=ja:, en=en:, alias]",
226
226
  'area:[ベトナム#{?LY=LY}#{&DN=DN}=ja:%%<元号>#%.<ベトナム>,Vietnam#{?LY=LY}#{&DN=DN}=en:Vietnam]',
227
227
  [self,
228
- "period:[前李朝,Early Lý Dynasty]",
228
+ "period:[前李朝=zh:%%<前李朝>,Early Lý Dynasty]",
229
229
  ["[天徳,alias:大徳]1","@F","name=[李賁];544.01^Chinese0445", "548.03.21="],
230
- ["[桃郎王]1", "@A","name=[李天宝];548.03.21", "555="],
231
- ["[趙越王]1", "@A","name=[趙光復];548.03.21"],
232
- ["[後李南帝]1","@A","name=[李仏子];571", "590^Chinese0523", "602="]
230
+ ["[桃郎王=zh:%%<李天寶>]1", "@A","name=[李天宝=zh:%%<李天寶>];548.03.21", "555="],
231
+ ["[趙越王=zh:%%<趙光復>]1", "@A","name=[趙光復=zh:%%<趙光復>];548.03.21"],
232
+ ["[後李南帝=zh:%%<李佛子>]1","@A","name=[李仏子=zh:%%<李佛子>];571", "590^Chinese0523", "602="]
233
233
  ],
234
234
  [self,
235
235
  "period:[呉朝,Ngô Dynasty]",
@@ -46,14 +46,14 @@ module When
46
46
  "names:[day]",
47
47
  [When::BasicTypes::M17n,
48
48
  "names:[Week]",
49
- [DayOfWeek, "label:[Sunday, 日曜日]", {'delta'=>7}],
50
- [DayOfWeek, "label:[Monday, 月曜日]", {'delta'=>7}],
51
- [DayOfWeek, "label:[Tuesday, 火曜日]", {'delta'=>7}],
52
- [DayOfWeek, "label:[Wednesday, 水曜日]", {'delta'=>7}],
53
- [DayOfWeek, "label:[Thursday, 木曜日]", {'delta'=>7}],
54
- [DayOfWeek, "label:[Friday, 金曜日]", {'delta'=>7}],
55
- [DayOfWeek, "label:[Saturday, 土曜日]", {'delta'=>7}],
56
- [DayOfWeek, "label:[Worldsday, 週外日]", {'delta'=>183}],
49
+ [DayOfWeek, "label:[Sunday, 日曜日, /date/day_names/0]", {'delta'=>7}],
50
+ [DayOfWeek, "label:[Monday, 月曜日, /date/day_names/1]", {'delta'=>7}],
51
+ [DayOfWeek, "label:[Tuesday, 火曜日, /date/day_names/2]", {'delta'=>7}],
52
+ [DayOfWeek, "label:[Wednesday, 水曜日, /date/day_names/3]", {'delta'=>7}],
53
+ [DayOfWeek, "label:[Thursday, 木曜日, /date/day_names/4]", {'delta'=>7}],
54
+ [DayOfWeek, "label:[Friday, 金曜日, /date/day_names/5]", {'delta'=>7}],
55
+ [DayOfWeek, "label:[Saturday, 土曜日, /date/day_names/6]", {'delta'=>7}],
56
+ [DayOfWeek, "label:[Worldsday=, 週外日=]", {'delta'=>366}],
57
57
  ],
58
58
 
59
59
  "[Common_Week]"
@@ -159,13 +159,9 @@ module When
159
159
  #
160
160
  # World calendar based on Gregorian calendar
161
161
  #
162
- World = [CyclicTableBased, {
162
+ World = [YearLengthTableBased, {
163
163
  'label' => 'World::World',
164
- 'origin_of_LSC' => 1721060,
165
164
  'rule_table' => {
166
- 'T' => {'Rule' =>['LC', 'SC', 'SC', 'SC']},
167
- 'SC' => {'Rule' =>[365]*4 + [366, 365, 365, 365]*24},
168
- 'LC' => {'Rule' =>[366, 365, 365, 365]*25},
169
165
  365 => {'Length'=>[31,30,30]*3 + [31,30,31]},
170
166
  366 => {'Length'=>[31,30,30,31,30,31] *2}
171
167
  },
@@ -0,0 +1,89 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2014 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
6
+ =end
7
+
8
+ module When
9
+
10
+ class BasicTypes::M17n
11
+
12
+ WorldSeason = [self, [
13
+ "locale:[=en:, ja=ja:, alias]",
14
+ "names:[WorldSeason=]",
15
+ "[WorldSeason=http://calendars.wikia.com/wiki/World_Season_Calendar, アシモフの季節暦=]"
16
+ ]]
17
+ end
18
+
19
+ #
20
+ # WorldSeason Week
21
+ #
22
+ class CalendarNote::WorldSeasonWeek < CalendarNote::Week
23
+
24
+ #
25
+ # WorldSeason Note
26
+ #
27
+ Notes = [When::BasicTypes::M17n, [
28
+ "locale:[=en:, ja=ja:, alias]",
29
+ "names:[WorldSeason]",
30
+
31
+ # Notes for year ----------------------------
32
+ [When::BasicTypes::M17n,
33
+ "names:[year]"
34
+ ],
35
+
36
+ # Notes for month ----------------------------
37
+ [When::BasicTypes::M17n,
38
+ "names:[month]",
39
+ [When::BasicTypes::M17n,
40
+ "names:[Month]",
41
+ "[A=] ",
42
+ "[B=] ",
43
+ "[C=] ",
44
+ "[D=] "
45
+ ]
46
+ ],
47
+
48
+ # Notes for day ----------------------------
49
+ [When::BasicTypes::M17n,
50
+ "names:[day]",
51
+ [When::BasicTypes::M17n,
52
+ "names:[Week]",
53
+ [DayOfWeek, "label:[Sunday, 日曜日, /date/day_names/0]", {'delta'=> 7}],
54
+ [DayOfWeek, "label:[Monday, 月曜日, /date/day_names/1]", {'delta'=> 7}],
55
+ [DayOfWeek, "label:[Tuesday, 火曜日, /date/day_names/2]", {'delta'=> 7}],
56
+ [DayOfWeek, "label:[Wednesday, 水曜日, /date/day_names/3]", {'delta'=> 7}],
57
+ [DayOfWeek, "label:[Thursday, 木曜日, /date/day_names/4]", {'delta'=> 7}],
58
+ [DayOfWeek, "label:[Friday, 金曜日, /date/day_names/5]", {'delta'=> 7}],
59
+ [DayOfWeek, "label:[Saturday, 土曜日, /date/day_names/6]", {'delta'=> 7}],
60
+ [DayOfWeek, "label:[OutOfWeek=, 週外日=]", {'delta'=>366}]
61
+ ],
62
+
63
+ "[Common_Week]"
64
+ ]
65
+ ]]
66
+
67
+ fixed_week_definitions(7*13)
68
+
69
+ end
70
+
71
+ module CalendarTypes
72
+ #
73
+ # WorldSeason calendar based on Gregorian calendar
74
+ #
75
+ WorldSeason = [YearLengthTableBased, {
76
+ 'label' => 'WorldSeason::WorldSeason',
77
+ 'indices' => [
78
+ When.Index('WorldSeasonWeekNotes::month::Month', {:unit =>4}),
79
+ When::Coordinates::DefaultDayIndex
80
+ ],
81
+ 'engine_day' => -10, # 11th day before new year
82
+ 'rule_table' => {
83
+ 365 => {'Length'=>[91] * 3 + [92]},
84
+ 366 => {'Length'=>[91, 92] * 2}
85
+ },
86
+ 'note' => 'WorldSeasonWeek'
87
+ }]
88
+ end
89
+ end