when_exe 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -23
  3. data/lib/when_exe/ephemeris/moon.rb +333 -333
  4. data/lib/when_exe/linkeddata.rb +0 -1
  5. data/lib/when_exe/locales/encoding_conversion.rb +134 -134
  6. data/lib/when_exe/locales/iast.rb +90 -90
  7. data/lib/when_exe/locales/transliteration_table.rb +62 -62
  8. data/lib/when_exe/parts/method_cash.rb +224 -224
  9. data/lib/when_exe/region/chinese/calendars.rb +1016 -1016
  10. data/lib/when_exe/region/geologicalage.rb +1 -1
  11. data/lib/when_exe/region/japanese/calendars.rb +397 -397
  12. data/lib/when_exe/region/japanese/eclipses.rb +1194 -1194
  13. data/lib/when_exe/region/japanese/nihon_shoki.rb +70 -70
  14. data/lib/when_exe/region/korean.rb +384 -384
  15. data/lib/when_exe/region/ryukyu.rb +101 -101
  16. data/lib/when_exe/tmposition.rb +2 -2
  17. data/lib/when_exe/tmreference.rb +3 -3
  18. data/lib/when_exe/version.rb +1 -1
  19. data/test/scripts/geometric_complex.rb +41 -41
  20. data/test/scripts/korea.rb +59 -59
  21. data/test/scripts/thai.rb +36 -36
  22. data/test/test/basictypes.rb +431 -431
  23. data/test/test/calendarnote.rb +86 -86
  24. data/test/test/calendartypes.rb +97 -97
  25. data/test/test/coordinates.rb +397 -397
  26. data/test/test/ephemeris.rb +115 -115
  27. data/test/test/ephemeris/moon.rb +14 -14
  28. data/test/test/ephemeris/planets.rb +14 -14
  29. data/test/test/ephemeris/sun.rb +14 -14
  30. data/test/test/inspect.rb +153 -153
  31. data/test/test/parts.rb +488 -488
  32. data/test/test/region/armenian.rb +20 -20
  33. data/test/test/region/bahai.rb +58 -58
  34. data/test/test/region/balinese.rb +34 -34
  35. data/test/test/region/chinese.rb +229 -229
  36. data/test/test/region/christian.rb +226 -226
  37. data/test/test/region/coptic.rb +27 -27
  38. data/test/test/region/discordian.rb +20 -20
  39. data/test/test/region/french.rb +33 -33
  40. data/test/test/region/geologicalage.rb +17 -17
  41. data/test/test/region/iran.rb +54 -54
  42. data/test/test/region/islamic.rb +54 -54
  43. data/test/test/region/japanese.rb +261 -261
  44. data/test/test/region/jewish.rb +63 -63
  45. data/test/test/region/shire.rb +58 -58
  46. data/test/test/region/swedish.rb +45 -45
  47. data/test/test/region/thai.rb +116 -116
  48. data/test/test/region/tibetan.rb +30 -30
  49. data/test/test/region/vietnamese.rb +102 -102
  50. data/test/test/region/zoroastrian.rb +58 -58
  51. data/test/test/timestandard.rb +81 -81
  52. data/test/test/tmobjects.rb +402 -402
  53. data/test/test/tmreference.rb +157 -157
  54. metadata +4 -88
@@ -1,101 +1,101 @@
1
- # -*- coding: utf-8 -*-
2
- =begin
3
- Copyright (C) 2013-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
- require 'when_exe/region/japanese/calendars'
9
- require 'when_exe/region/chinese/calendars'
10
-
11
- #
12
- # 琉球王位一覧表
13
- #
14
- # (参考文献)
15
- # 沖縄県の歴史(山川出版社)巻末年表など
16
- # 沖縄の歴史と文化(中公新書)
17
- # コンサイス世界年表(三省堂)
18
- #
19
- module When
20
- class TM::CalendarEra
21
-
22
- #
23
- # 琉球王朝
24
- #
25
- Ryukyu = [{'V'=>{'Japanese'=>{'T'=>'Japanese?note=Chinese'},
26
- 'Chinese' =>{'T'=>'Chinese1645' }}}, self, [
27
- "locale:[=ja:, en=en:, alias]",
28
- 'area:[琉球#{?V=V}=ja:%%<琉球王国>,Ryukyu#{?V=V}=en:Ryukyu_Kingdom]',
29
- [self,
30
- "period:[舜天王統]", # 嗣 ~ 没 or 譲位
31
- ["[<舜天>]1", "@F", "name=[舜天];1187^Chinese0956"], # 文治 3~嘉禎 3(1237) 72歳
32
- ["[<舜馬順熙>=ja:%%<舜馬順煕>]1", "@A", "name=[舜馬順熙=ja:%%<舜馬順煕>];1238"], # 嘉禎 4~宝治 2(1248) 64歳
33
- ["[<義本>]1", "@A", "name=[義本];1249" , "1259"] # 宝治 3~正嘉 3(1259) 英祖に譲位
34
- ],
35
- [self,
36
- "period:[英祖王統]",
37
- ["[<英祖>=ja:%%<英祖_(琉球国王)>]0", "@F", "name=[英祖=ja:%%<英祖_(琉球国王)>];1259^Chinese0939"], # 正元 2~正安 元(1299) 8 5 71歳
38
- ["[<大成>=ja:%%<大成_(琉球国王)>]0", "@A", "name=[大成=ja:%%<大成_(琉球国王)>];1299-08-05"], # 正安 2~延慶 元(1308) 12 8 62歳
39
- ["[<英慈>]0", "@A", "name=[英慈];1308-12-08"], # 延慶 2~正和 2(1313) 9 20 46歳
40
- ["[<玉城>=ja:%%<玉城_(琉球国王)>]0", "@A", "name=[玉城=ja:%%<玉城_(琉球国王)>];1313-09-20"], # 正和 3~延元 元(1336) 3 11 41歳
41
- ["[<西威>]0", "@A", "name=[西威];1336-03-11", "1349-04-13"] # 延元 2~貞和 5(1349) 4 13 22歳
42
- ],
43
- [self,
44
- "period:[中山王国]",
45
- ["[<察度>]0", "@A", "name=[察度];1349-04-13^Chinese0939"], # 貞和 6~応永 2(1395) 10 5 75歳
46
- ["[<武寧>]0", "@A", "name=[武寧];1395-10-05", "1406"] # 応永 3~応永 13(1406) 尚巴志が滅ぼす
47
- ],
48
- [self,
49
- "period:[山北王国]",
50
- ["[<怕尼芝>]1", "@A", "name=[怕尼芝];1322^Chinese0939"], # 1383年初めて明に朝貢
51
- ["[<珉>=ja:%%<ミン_(琉球国王)>]0", "@A", "name=[珉=ja:%%<ミン_(琉球国王)>];1395"],
52
- ["[<攀安知>]0", "@A", "name=[攀安知];1400", "1416="] # 永楽元年(1403)衣冠束帯を乞う 尚巴志が滅ぼす
53
- ],
54
- [self,
55
- "period:[山南王国]",
56
- ["[<承察度>]1", "@A", "name=[承察度];1337^Chinese0939"], # 1380年初めて明に朝貢
57
- ["[<汪英紫>]1", "@A", "name=[汪英紫];1388"],
58
- ["[<汪応祖>]0", "@A", "name=[汪応祖];1402"], # 承察度の従弟 明永楽2年(1404)冊封
59
- ["[<他魯毎>]0", "@A", "name=[他魯毎];1413", "1429="] # 汪応祖の子 永楽14年(1416)冊封 尚巴志が滅ぼす
60
- ],
61
- [self,
62
- "period:[第一尚氏]",
63
- ["[<尚思紹王>]1", "@F", "name=[尚思紹王];1406^Chinese0939"], # 応永 13~応永 28(1421)
64
- ["[<尚巴志王>]0", "@A", "name=[尚巴志王];1421"], # 応永 29~永享 11(1439) 4 20 68歳
65
- ["[<尚忠王>]0", "@A", "name=[尚忠王];1439-04-20"], # 永享 12~文安 元(1444) 10 24 54歳
66
- ["[<尚思達王>]0", "@A", "name=[尚思達王];1444-10-24"], # 文安 2~宝徳 元(1449) 10 13 42歳
67
- ["[<尚金福王>]0", "@A", "name=[尚金福王];1449-10-13"], # 宝徳 2~享徳 2(1453) 4 18 56歳, 『中山世譜』で4月29日から訂正
68
- ["[<尚泰久王>]0", "@A", "name=[尚泰久王];1453-04-29"], # 享徳 3~長禄 4(1460) 6 5 46歳
69
- ["[<尚徳王>]0", "@A", "name=[尚徳王];1460-06-05","1469-04-23"] # 寛正 2~応仁 3(1469) 4 22 29歳 4-23は丙子
70
- ],
71
- [self,
72
- "period:[第二尚氏]",
73
- ["[<尚円王>]0", "@F", "name=[尚円王];1469-04-23^Chinese0939"], # 文明 2~文明 8(1476) 7 28 62歳
74
- ["[<尚宣威王>]0", "@A", "name=[尚宣威王];1476-07-28"], # 文明 9~同年 (1477) 8 4 48歳 戊戌 没
75
- ["[<尚真王>]1", "@A", "name=[尚真王];1477-02"], # 文明 9~大永 6(1526) 12 11 62歳 己未
76
- # 1447-02 は『琉球国中山世鑑』
77
- # http://dl.ndl.go.jp/info:ndljp/pid/1217404/43
78
- ["[<尚清王>]0", "@A", "name=[尚清王];1526-12-11"], # 大永 7~天文 24(1555) 6 25 59歳
79
- ["[<尚元王>]0", "@A", "name=[尚元王];1555-06-25"], # 弘治 2~元亀 3(1572) 4 1 45歳
80
- ["[<尚永王>]0", "@A", "name=[尚永王];1572-04-01"], # 天正 元~天正 16(1588) 11 25 30歳
81
- ["[<尚寧王>]0", "@A", "name=[尚寧王];1588-11-25", # 天正 17~元和 6(1620) 9 19 57歳
82
- '1609-04-05^#{T:Chinese1645}', ""], # 慶長 14(1609) 4 5 尚寧、島津と和議
83
- # (デフォルトは中国暦日)
84
- ["[<尚豊王>]0", "@A", "name=[尚豊王];1620-09-19"], # 元和 7~寛永 17(1640) 5 4 51歳 甲申
85
- ["[<尚賢王>]0", "@A", "name=[尚賢王];1640-05-{甲申}"], # 寛永 18~正保 4(1647) 9 22 23歳
86
- ["[<尚質王>]0", "@A", "name=[尚質王];1647-09-22"], # 慶安 元~寛文 8(1668) 11 17 40歳
87
- ["[<尚貞王>]0", "@A", "name=[尚貞王];1668-11-17"], # 寛文 9~宝永 6(1709) 7 13 65歳
88
- ["[<尚益王>]0", "@A", "name=[尚益王];1709-07-13"], # 宝永 7~正徳 2(1712) 7 15 35歳
89
- ["[<尚敬王>]0", "@A", "name=[尚敬王];1712-07-15"], # 正徳 3~寛延 4(1751) 1 29 52歳
90
- ["[<尚穆王>]0", "@A", "name=[尚穆王];1751-01-29"], # 宝暦 2~寛政 6(1794) 4 8 56歳
91
- ["[<尚温王>]0", "@A", "name=[尚温王];1794-04-08"], # 寛政 7~享和 2(1802) 7 11 19歳
92
- ["[<尚成王>]0", "@A", "name=[尚成王];1802-07-11"], # 享和 3~同年 (1803) 12 26 4歳
93
- ["[<尚灝王>=ja:%%<尚コウ王>]0", "@A", "name=[尚灝王=ja:%%<尚コウ王>];1803-12-26"], # 文化 元~文政 10(1827) 出家
94
- ["[<尚育摂位>=ja:%%<尚育王>]0", "", "name=[尚育王];1827-03-08"], # 文政 11(1828) 摂位, 『沖縄県の歴史』で月日を追記
95
- ["[<尚育王>]7", "@A", "name=[尚育王];1834-05-29"], # 天保 6~弘化 4(1847) 9 17 35歳
96
- ["[<尚泰王>]0", "@A", "name=[尚泰王];1847-09-17", # 弘化 5~明治 12(1879) 3 31 琉球処分
97
- "1873-01-01^Gregorian", "1879-03-31="] # 明治 34(1901) 8 19 59歳 没
98
- ]
99
- ]]
100
- end
101
- end
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2013-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
+ require 'when_exe/region/japanese/calendars'
9
+ require 'when_exe/region/chinese/calendars'
10
+
11
+ #
12
+ # 琉球王位一覧表
13
+ #
14
+ # (参考文献)
15
+ # 沖縄県の歴史(山川出版社)巻末年表など
16
+ # 沖縄の歴史と文化(中公新書)
17
+ # コンサイス世界年表(三省堂)
18
+ #
19
+ module When
20
+ class TM::CalendarEra
21
+
22
+ #
23
+ # 琉球王朝
24
+ #
25
+ Ryukyu = [{'V'=>{'Japanese'=>{'T'=>'Japanese?note=Chinese'},
26
+ 'Chinese' =>{'T'=>'Chinese1645' }}}, self, [
27
+ "locale:[=ja:, en=en:, alias]",
28
+ 'area:[琉球#{?V=V}=ja:%%<琉球王国>,Ryukyu#{?V=V}=en:Ryukyu_Kingdom]',
29
+ [self,
30
+ "period:[舜天王統]", # 嗣 ~ 没 or 譲位
31
+ ["[<舜天>]1", "@F", "name=[舜天];1187^Chinese0956"], # 文治 3~嘉禎 3(1237) 72歳
32
+ ["[<舜馬順熙>=ja:%%<舜馬順煕>]1", "@A", "name=[舜馬順熙=ja:%%<舜馬順煕>];1238"], # 嘉禎 4~宝治 2(1248) 64歳
33
+ ["[<義本>]1", "@A", "name=[義本];1249" , "1259"] # 宝治 3~正嘉 3(1259) 英祖に譲位
34
+ ],
35
+ [self,
36
+ "period:[英祖王統]",
37
+ ["[<英祖>=ja:%%<英祖_(琉球国王)>]0", "@F", "name=[英祖=ja:%%<英祖_(琉球国王)>];1259^Chinese0939"], # 正元 2~正安 元(1299) 8 5 71歳
38
+ ["[<大成>=ja:%%<大成_(琉球国王)>]0", "@A", "name=[大成=ja:%%<大成_(琉球国王)>];1299-08-05"], # 正安 2~延慶 元(1308) 12 8 62歳
39
+ ["[<英慈>]0", "@A", "name=[英慈];1308-12-08"], # 延慶 2~正和 2(1313) 9 20 46歳
40
+ ["[<玉城>=ja:%%<玉城_(琉球国王)>]0", "@A", "name=[玉城=ja:%%<玉城_(琉球国王)>];1313-09-20"], # 正和 3~延元 元(1336) 3 11 41歳
41
+ ["[<西威>]0", "@A", "name=[西威];1336-03-11", "1349-04-13"] # 延元 2~貞和 5(1349) 4 13 22歳
42
+ ],
43
+ [self,
44
+ "period:[中山王国]",
45
+ ["[<察度>]0", "@A", "name=[察度];1349-04-13^Chinese0939"], # 貞和 6~応永 2(1395) 10 5 75歳
46
+ ["[<武寧>]0", "@A", "name=[武寧];1395-10-05", "1406"] # 応永 3~応永 13(1406) 尚巴志が滅ぼす
47
+ ],
48
+ [self,
49
+ "period:[山北王国]",
50
+ ["[<怕尼芝>]1", "@A", "name=[怕尼芝];1322^Chinese0939"], # 1383年初めて明に朝貢
51
+ ["[<珉>=ja:%%<ミン_(琉球国王)>]0", "@A", "name=[珉=ja:%%<ミン_(琉球国王)>];1395"],
52
+ ["[<攀安知>]0", "@A", "name=[攀安知];1400", "1416="] # 永楽元年(1403)衣冠束帯を乞う 尚巴志が滅ぼす
53
+ ],
54
+ [self,
55
+ "period:[山南王国]",
56
+ ["[<承察度>]1", "@A", "name=[承察度];1337^Chinese0939"], # 1380年初めて明に朝貢
57
+ ["[<汪英紫>]1", "@A", "name=[汪英紫];1388"],
58
+ ["[<汪応祖>]0", "@A", "name=[汪応祖];1402"], # 承察度の従弟 明永楽2年(1404)冊封
59
+ ["[<他魯毎>]0", "@A", "name=[他魯毎];1413", "1429="] # 汪応祖の子 永楽14年(1416)冊封 尚巴志が滅ぼす
60
+ ],
61
+ [self,
62
+ "period:[第一尚氏]",
63
+ ["[<尚思紹王>]1", "@F", "name=[尚思紹王];1406^Chinese0939"], # 応永 13~応永 28(1421)
64
+ ["[<尚巴志王>]0", "@A", "name=[尚巴志王];1421"], # 応永 29~永享 11(1439) 4 20 68歳
65
+ ["[<尚忠王>]0", "@A", "name=[尚忠王];1439-04-20"], # 永享 12~文安 元(1444) 10 24 54歳
66
+ ["[<尚思達王>]0", "@A", "name=[尚思達王];1444-10-24"], # 文安 2~宝徳 元(1449) 10 13 42歳
67
+ ["[<尚金福王>]0", "@A", "name=[尚金福王];1449-10-13"], # 宝徳 2~享徳 2(1453) 4 18 56歳, 『中山世譜』で4月29日から訂正
68
+ ["[<尚泰久王>]0", "@A", "name=[尚泰久王];1453-04-29"], # 享徳 3~長禄 4(1460) 6 5 46歳
69
+ ["[<尚徳王>]0", "@A", "name=[尚徳王];1460-06-05","1469-04-23"] # 寛正 2~応仁 3(1469) 4 22 29歳 4-23は丙子
70
+ ],
71
+ [self,
72
+ "period:[第二尚氏]",
73
+ ["[<尚円王>]0", "@F", "name=[尚円王];1469-04-23^Chinese0939"], # 文明 2~文明 8(1476) 7 28 62歳
74
+ ["[<尚宣威王>]0", "@A", "name=[尚宣威王];1476-07-28"], # 文明 9~同年 (1477) 8 4 48歳 戊戌 没
75
+ ["[<尚真王>]1", "@A", "name=[尚真王];1477-02"], # 文明 9~大永 6(1526) 12 11 62歳 己未
76
+ # 1447-02 は『琉球国中山世鑑』
77
+ # http://dl.ndl.go.jp/info:ndljp/pid/1217404/43
78
+ ["[<尚清王>]0", "@A", "name=[尚清王];1526-12-11"], # 大永 7~天文 24(1555) 6 25 59歳
79
+ ["[<尚元王>]0", "@A", "name=[尚元王];1555-06-25"], # 弘治 2~元亀 3(1572) 4 1 45歳
80
+ ["[<尚永王>]0", "@A", "name=[尚永王];1572-04-01"], # 天正 元~天正 16(1588) 11 25 30歳
81
+ ["[<尚寧王>]0", "@A", "name=[尚寧王];1588-11-25", # 天正 17~元和 6(1620) 9 19 57歳
82
+ '1609-04-05^#{T:Chinese1645}', ""], # 慶長 14(1609) 4 5 尚寧、島津と和議
83
+ # (デフォルトは中国暦日)
84
+ ["[<尚豊王>]0", "@A", "name=[尚豊王];1620-09-19"], # 元和 7~寛永 17(1640) 5 4 51歳 甲申
85
+ ["[<尚賢王>]0", "@A", "name=[尚賢王];1640-05-{甲申}"], # 寛永 18~正保 4(1647) 9 22 23歳
86
+ ["[<尚質王>]0", "@A", "name=[尚質王];1647-09-22"], # 慶安 元~寛文 8(1668) 11 17 40歳
87
+ ["[<尚貞王>]0", "@A", "name=[尚貞王];1668-11-17"], # 寛文 9~宝永 6(1709) 7 13 65歳
88
+ ["[<尚益王>]0", "@A", "name=[尚益王];1709-07-13"], # 宝永 7~正徳 2(1712) 7 15 35歳
89
+ ["[<尚敬王>]0", "@A", "name=[尚敬王];1712-07-15"], # 正徳 3~寛延 4(1751) 1 29 52歳
90
+ ["[<尚穆王>]0", "@A", "name=[尚穆王];1751-01-29"], # 宝暦 2~寛政 6(1794) 4 8 56歳
91
+ ["[<尚温王>]0", "@A", "name=[尚温王];1794-04-08"], # 寛政 7~享和 2(1802) 7 11 19歳
92
+ ["[<尚成王>]0", "@A", "name=[尚成王];1802-07-11"], # 享和 3~同年 (1803) 12 26 4歳
93
+ ["[<尚灝王>=ja:%%<尚コウ王>]0", "@A", "name=[尚灝王=ja:%%<尚コウ王>];1803-12-26"], # 文化 元~文政 10(1827) 出家
94
+ ["[<尚育摂位>=ja:%%<尚育王>]0", "", "name=[尚育王];1827-03-08"], # 文政 11(1828) 摂位, 『沖縄県の歴史』で月日を追記
95
+ ["[<尚育王>]7", "@A", "name=[尚育王];1834-05-29"], # 天保 6~弘化 4(1847) 9 17 35歳
96
+ ["[<尚泰王>]0", "@A", "name=[尚泰王];1847-09-17", # 弘化 5~明治 12(1879) 3 31 琉球処分
97
+ "1873-01-01^Gregorian", "1879-03-31="] # 明治 34(1901) 8 19 59歳 没
98
+ ]
99
+ ]]
100
+ end
101
+ end
@@ -1047,7 +1047,7 @@ module When::TM
1047
1047
  # @param [Hash] options see {When::TM::TemporalPosition._instance}
1048
1048
  #
1049
1049
  def initialize(options={})
1050
- options.reject! {|key,value| value == nil}
1050
+ options.reject! {|key,value| !value}
1051
1051
  options.each_pair do |key,value|
1052
1052
  self.instance_variable_set("@#{key}", value)
1053
1053
  end
@@ -1912,7 +1912,7 @@ module When::TM
1912
1912
  def _normalize(options={})
1913
1913
 
1914
1914
  # 日付配列の長さ
1915
- cal_date_index = @cal_date.index(nil) || @cal_date.length
1915
+ cal_date_index = @cal_date.compact.length
1916
1916
 
1917
1917
  # 日付の正規化
1918
1918
  if @calendar_era_props
@@ -665,7 +665,7 @@ module When::TM
665
665
  # 時刻配列の分解能
666
666
  # @private
667
667
  def _precision(time, default=nil)
668
- nil_index = time.index(nil) || time.length
668
+ nil_index = time.compact.length
669
669
  precision = nil_index - 1 if (nil_index < @base.length || time[-1].kind_of?(Integer))
670
670
  When::Coordinates::Index.precision(default || precision)
671
671
  end
@@ -1561,9 +1561,9 @@ module When::TM
1561
1561
  raise ArgumentError, "JulianReference and ReferenceDate are mismatch" unless (@epoch_year == +j_date[0]-(+r_date[0]))
1562
1562
  raise ArgumentError, "JulianReference and ReferenceDate are mismatch" unless (j_date[1..-1] == r_date[1..-1])
1563
1563
  #raise ArgumentError, "JulianReference and ReferenceDate are mismatch" unless (j_date == r_date)
1564
- if (r_date[1] == nil)
1564
+ if !r_date[1]
1565
1565
  @reference_date.precision = When::YEAR
1566
- elsif (r_date[2] == nil)
1566
+ elsif !r_date[2]
1567
1567
  @reference_date.precision = When::MONTH
1568
1568
  end
1569
1569
  end
@@ -6,7 +6,7 @@
6
6
  =end
7
7
 
8
8
  module When
9
- VERSION = "0.4.2"
9
+ VERSION = "0.4.3"
10
10
  YEARS = "(C) 2011-2015"
11
11
  AUTHOR = "Takashi SUGA"
12
12
  COPYRIGHT = "#{YEARS} #{AUTHOR}"
@@ -1,41 +1,41 @@
1
- # -*- coding: utf-8 -*-
2
- =begin
3
- Copyright (C) 2011-2013 Takashi SUGA
4
-
5
- You may use and/or modify this file according to the license
6
- described in the LICENSE.txt file included in this archive.
7
- =end
8
-
9
- require 'pp'
10
- require 'when_exe'
11
- include When
12
-
13
- range_null = Parts::GeometricComplex.new()
14
- range_1_1 = Parts::GeometricComplex.new(1)
15
- range_1_4 = Parts::GeometricComplex.new(1,4)
16
- range_2_2 = Parts::GeometricComplex.new(2)
17
- range_2_3 = Parts::GeometricComplex.new(2,3)
18
- range_2_5 = Parts::GeometricComplex.new(2,5)
19
- range_4_4 = Parts::GeometricComplex.new(4)
20
- pp range_1_4
21
- pp range_2_3
22
- range_1_4.each {|x| pp x}
23
- pp range_4_4
24
- pp range_1_4 | range_2_3
25
- pp range_1_4.include?(range_2_2)
26
- pp range_1_4.include?(range_2_3)
27
- range_1_5 = range_1_4 | range_2_5
28
- pp range_1_5
29
- pp range_1_4.include?(range_2_5)
30
- pp range_1_4 | range_4_4
31
- pp range_1_4.include?(range_4_4)
32
- reverse_all = Parts::GeometricComplex.new(true)
33
- reverse_1_4 = Parts::GeometricComplex.new(1,4, true)
34
- reverse_2_3 = Parts::GeometricComplex.new(2,3, true)
35
- reverse_2_5 = Parts::GeometricComplex.new(2,5, true)
36
- pp reverse_all
37
- pp reverse_1_4
38
- pp reverse_2_3
39
- pp reverse_2_3 | range_2_3
40
- pp reverse_1_4 | range_2_5
41
-
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ Copyright (C) 2011-2013 Takashi SUGA
4
+
5
+ You may use and/or modify this file according to the license
6
+ described in the LICENSE.txt file included in this archive.
7
+ =end
8
+
9
+ require 'pp'
10
+ require 'when_exe'
11
+ include When
12
+
13
+ range_null = Parts::GeometricComplex.new()
14
+ range_1_1 = Parts::GeometricComplex.new(1)
15
+ range_1_4 = Parts::GeometricComplex.new(1,4)
16
+ range_2_2 = Parts::GeometricComplex.new(2)
17
+ range_2_3 = Parts::GeometricComplex.new(2,3)
18
+ range_2_5 = Parts::GeometricComplex.new(2,5)
19
+ range_4_4 = Parts::GeometricComplex.new(4)
20
+ pp range_1_4
21
+ pp range_2_3
22
+ range_1_4.each {|x| pp x}
23
+ pp range_4_4
24
+ pp range_1_4 | range_2_3
25
+ pp range_1_4.include?(range_2_2)
26
+ pp range_1_4.include?(range_2_3)
27
+ range_1_5 = range_1_4 | range_2_5
28
+ pp range_1_5
29
+ pp range_1_4.include?(range_2_5)
30
+ pp range_1_4 | range_4_4
31
+ pp range_1_4.include?(range_4_4)
32
+ reverse_all = Parts::GeometricComplex.new(true)
33
+ reverse_1_4 = Parts::GeometricComplex.new(1,4, true)
34
+ reverse_2_3 = Parts::GeometricComplex.new(2,3, true)
35
+ reverse_2_5 = Parts::GeometricComplex.new(2,5, true)
36
+ pp reverse_all
37
+ pp reverse_1_4
38
+ pp reverse_2_3
39
+ pp reverse_2_3 | range_2_3
40
+ pp reverse_1_4 | range_2_5
41
+
@@ -1,59 +1,59 @@
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
- require 'when_exe'
9
- require 'when_exe/region/chinese/calendars'
10
- include When
11
-
12
- class When::TM::CalendarEra
13
- Korea = [self, [
14
- 'namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]',
15
- 'locale:[=en:, ja=ja:, alias]',
16
- 'area:[Korea, 朝鮮]',
17
- ['[秦漢]1.01.01', '@CR', "1-01-01^Chinese_103"],
18
- ['[魏晋]239.01.01', '@CR', "239-01-01^Chinese0239"],
19
- ['[南朝]451.01.01', '@CR', "451-01-01^Chinese0445"],
20
- ['[隋唐]590.01.01', '@CR', "590-01-01^Chinese0523"],
21
- ['[宣明]893.01.01', '@CR', "893-01-01^ChineseTwin::宣明暦"],
22
- ['[大統]1309.01.01', '@CR', "1309-01-01^Chinese0939"],
23
- ['[時憲]1653.01.01', '@CR', "1653-01-01^Chinese1645"],
24
- ['[旧暦]1912.01.01', '@CR', "1912-01-01^ChineseLuniSolar?time_basis=+09:00"]
25
- ]]
26
- end
27
-
28
- R = {'10-'=>'0X-', '11-'=>'0N-', '12-'=>'0D-'}
29
-
30
- def list_1st_day(range, calendar)
31
- range.each do |year|
32
- list = "%4d" % year
33
- kdate = first = when?("Korea#{year}.1.1")
34
- loop do
35
- wdate = (calendar ^ kdate).to_s[-5..-1]
36
- wdate.sub!(/1.-/) {|c| R[c]}
37
- wdate.sub!(/^0/, '')
38
- wdate.sub!('-', '+') if kdate.length(MONTH) == 30
39
- list += (kdate[MONTH] * 0 == 0) ? " #{wdate} " : " (#{wdate})"
40
- kdate += P1M
41
- break unless year == kdate[YEAR]
42
- end
43
- puts list
44
- =begin
45
- list = " "
46
- kdate = first
47
- loop do
48
- wdate = (Residue('干支') % kdate).label
49
- list += (kdate[MONTH] * 0 == 0) ? " #{wdate} " : " (#{wdate})"
50
- kdate += P1M
51
- break unless year == kdate[YEAR]
52
- end
53
- puts list
54
- =end
55
- puts if year % 10 == 0
56
- end
57
- end
58
-
59
- list_1st_day(1..1895, Civil)
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
+ require 'when_exe'
9
+ require 'when_exe/region/chinese/calendars'
10
+ include When
11
+
12
+ class When::TM::CalendarEra
13
+ Korea = [self, [
14
+ 'namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]',
15
+ 'locale:[=en:, ja=ja:, alias]',
16
+ 'area:[Korea, 朝鮮]',
17
+ ['[秦漢]1.01.01', '@CR', "1-01-01^Chinese_103"],
18
+ ['[魏晋]239.01.01', '@CR', "239-01-01^Chinese0239"],
19
+ ['[南朝]451.01.01', '@CR', "451-01-01^Chinese0445"],
20
+ ['[隋唐]590.01.01', '@CR', "590-01-01^Chinese0523"],
21
+ ['[宣明]893.01.01', '@CR', "893-01-01^ChineseTwin::宣明暦"],
22
+ ['[大統]1309.01.01', '@CR', "1309-01-01^Chinese0939"],
23
+ ['[時憲]1653.01.01', '@CR', "1653-01-01^Chinese1645"],
24
+ ['[旧暦]1912.01.01', '@CR', "1912-01-01^ChineseLuniSolar?time_basis=+09:00"]
25
+ ]]
26
+ end
27
+
28
+ R = {'10-'=>'0X-', '11-'=>'0N-', '12-'=>'0D-'}
29
+
30
+ def list_1st_day(range, calendar)
31
+ range.each do |year|
32
+ list = "%4d" % year
33
+ kdate = first = when?("Korea#{year}.1.1")
34
+ loop do
35
+ wdate = (calendar ^ kdate).to_s[-5..-1]
36
+ wdate.sub!(/1.-/) {|c| R[c]}
37
+ wdate.sub!(/^0/, '')
38
+ wdate.sub!('-', '+') if kdate.length(MONTH) == 30
39
+ list += (kdate[MONTH] * 0 == 0) ? " #{wdate} " : " (#{wdate})"
40
+ kdate += P1M
41
+ break unless year == kdate[YEAR]
42
+ end
43
+ puts list
44
+ =begin
45
+ list = " "
46
+ kdate = first
47
+ loop do
48
+ wdate = (Residue('干支') % kdate).label
49
+ list += (kdate[MONTH] * 0 == 0) ? " #{wdate} " : " (#{wdate})"
50
+ kdate += P1M
51
+ break unless year == kdate[YEAR]
52
+ end
53
+ puts list
54
+ =end
55
+ puts if year % 10 == 0
56
+ end
57
+ end
58
+
59
+ list_1st_day(1..1895, Civil)