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
@@ -23,7 +23,6 @@ module When
23
23
  'coordinate' => "TM/CalDate#cal_date-instance_method",
24
24
  'sdn' => "TM/CalDate#to_i-instance_method",
25
25
  'calendarEra' => "TM/CalDate#calendar_era-instance_method",
26
- 'referenceEvent' => "TM/Clock#reference_event-instance_method",
27
26
  'referenceTime' => "TM/Clock#reference_time-instance_method",
28
27
  'utcReference' => "TM/Clock#utc_reference-instance_method",
29
28
  'dateBasis' => "TM/Clock#date_basis-instance_method",
@@ -1,134 +1,134 @@
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
- #
11
- # エンコーディングの変換
12
- #
13
- module EncodingConversion
14
-
15
- class << self
16
- if String.method_defined?(:encode)
17
- #
18
- # 内部エンコーディング文字列化
19
- #
20
- # @param [Object] source もとにする Object
21
- #
22
- # @return [Object] 内部エンコーディング化した Object
23
- #
24
- # @private
25
- def to_internal_encoding(source)
26
- default_internal = Encoding.default_internal||'UTF-8'
27
- case source
28
- when Locale ; source.to_internal_encoding
29
- when String ; case source.encoding
30
- when default_internal ; source
31
- when Encoding::ASCII_8BIT ; source.dup.force_encoding(default_internal)
32
- else ; source.encode(default_internal)
33
- end
34
- when Regexp ; case source.encoding
35
- when default_internal ; source
36
- when Encoding::ASCII_8BIT ; Regexp.new(source.dup.force_encoding(default_internal))
37
- else ; Regexp.new(source.to_s.encode(default_internal))
38
- end
39
- when Array ; source.map {|e| to_internal_encoding(e)}
40
- when Hash
41
- hash = {}
42
- source.each_pair do |key, value|
43
- hash[to_internal_encoding(key)] = to_internal_encoding(value)
44
- end
45
- hash
46
- else ; source.respond_to?(:to_internal_encoding) ? source.to_internal_encoding : source
47
- end
48
- end
49
-
50
- #
51
- # 外部エンコーディング文字列化
52
- #
53
- # @param [Object] source もとにする Object
54
- #
55
- # @return [Object] 外部エンコーディング化した Object
56
- #
57
- # @private
58
- def to_external_encoding(source)
59
- default_external = Encoding.default_external
60
- case source
61
- when Locale ; source.to_external_encoding
62
- when String ; case source.encoding
63
- when default_external ; source
64
- when Encoding::ASCII_8BIT ; source.dup.force_encoding(default_external)
65
- else ; source.encode(default_external)
66
- end
67
- when Regexp ; case source.encoding
68
- when default_external ; source
69
- when Encoding::ASCII_8BIT ; Regexp.new(source.dup.force_encoding(default_external))
70
- else ; Regexp.new(source.to_s.encode(default_external))
71
- end
72
- when Array ; source.map {|e| to_external_encoding(e)}
73
- when Hash
74
- hash = {}
75
- source.each_pair do |key, value|
76
- hash[to_external_encoding(key)] = to_external_encoding(value)
77
- end
78
- hash
79
- else ; source.respond_to?(:to_external_encoding) ? source.to_external_encoding : source
80
- end
81
- end
82
-
83
- else
84
- # 内部エンコーディング文字列化(ダミー)
85
- #
86
- # @param [String] string もとにする String または M17n
87
- #
88
- # @return [String] そのまま返す
89
- #
90
- def to_internal_encoding(string)
91
- string
92
- end
93
- #
94
- # 外部エンコーディング文字列化(ダミー)
95
- #
96
- # @param [String] string もとにする String または M17n
97
- #
98
- # @return [String] そのまま返す
99
- #
100
- def to_external_encoding(string)
101
- string
102
- end
103
- end
104
- end
105
-
106
- #
107
- # 内部エンコーディング文字列化
108
- #
109
- def to_internal_encoding
110
- EncodingConversion.to_internal_encoding(self)
111
- end
112
-
113
- #
114
- # 外部エンコーディング文字列化
115
- #
116
- def to_external_encoding
117
- EncodingConversion.to_external_encoding(self)
118
- end
119
-
120
- #
121
- # 内部エンコーディング文字列化(単項)
122
- #
123
- def +@
124
- to_internal_encoding
125
- end
126
-
127
- #
128
- # 外部エンコーディング文字列化(単項)
129
- #
130
- def -@
131
- to_external_encoding
132
- end
133
- end
134
- end
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
+ #
11
+ # エンコーディングの変換
12
+ #
13
+ module EncodingConversion
14
+
15
+ class << self
16
+ if String.method_defined?(:encode)
17
+ #
18
+ # 内部エンコーディング文字列化
19
+ #
20
+ # @param [Object] source もとにする Object
21
+ #
22
+ # @return [Object] 内部エンコーディング化した Object
23
+ #
24
+ # @private
25
+ def to_internal_encoding(source)
26
+ default_internal = Encoding.default_internal||'UTF-8'
27
+ case source
28
+ when Locale ; source.to_internal_encoding
29
+ when String ; case source.encoding
30
+ when default_internal ; source
31
+ when Encoding::ASCII_8BIT ; source.dup.force_encoding(default_internal)
32
+ else ; source.encode(default_internal)
33
+ end
34
+ when Regexp ; case source.encoding
35
+ when default_internal ; source
36
+ when Encoding::ASCII_8BIT ; Regexp.new(source.dup.force_encoding(default_internal))
37
+ else ; Regexp.new(source.to_s.encode(default_internal))
38
+ end
39
+ when Array ; source.map {|e| to_internal_encoding(e)}
40
+ when Hash
41
+ hash = {}
42
+ source.each_pair do |key, value|
43
+ hash[to_internal_encoding(key)] = to_internal_encoding(value)
44
+ end
45
+ hash
46
+ else ; source.respond_to?(:to_internal_encoding) ? source.to_internal_encoding : source
47
+ end
48
+ end
49
+
50
+ #
51
+ # 外部エンコーディング文字列化
52
+ #
53
+ # @param [Object] source もとにする Object
54
+ #
55
+ # @return [Object] 外部エンコーディング化した Object
56
+ #
57
+ # @private
58
+ def to_external_encoding(source)
59
+ default_external = Encoding.default_external
60
+ case source
61
+ when Locale ; source.to_external_encoding
62
+ when String ; case source.encoding
63
+ when default_external ; source
64
+ when Encoding::ASCII_8BIT ; source.dup.force_encoding(default_external)
65
+ else ; source.encode(default_external)
66
+ end
67
+ when Regexp ; case source.encoding
68
+ when default_external ; source
69
+ when Encoding::ASCII_8BIT ; Regexp.new(source.dup.force_encoding(default_external))
70
+ else ; Regexp.new(source.to_s.encode(default_external))
71
+ end
72
+ when Array ; source.map {|e| to_external_encoding(e)}
73
+ when Hash
74
+ hash = {}
75
+ source.each_pair do |key, value|
76
+ hash[to_external_encoding(key)] = to_external_encoding(value)
77
+ end
78
+ hash
79
+ else ; source.respond_to?(:to_external_encoding) ? source.to_external_encoding : source
80
+ end
81
+ end
82
+
83
+ else
84
+ # 内部エンコーディング文字列化(ダミー)
85
+ #
86
+ # @param [String] string もとにする String または M17n
87
+ #
88
+ # @return [String] そのまま返す
89
+ #
90
+ def to_internal_encoding(string)
91
+ string
92
+ end
93
+ #
94
+ # 外部エンコーディング文字列化(ダミー)
95
+ #
96
+ # @param [String] string もとにする String または M17n
97
+ #
98
+ # @return [String] そのまま返す
99
+ #
100
+ def to_external_encoding(string)
101
+ string
102
+ end
103
+ end
104
+ end
105
+
106
+ #
107
+ # 内部エンコーディング文字列化
108
+ #
109
+ def to_internal_encoding
110
+ EncodingConversion.to_internal_encoding(self)
111
+ end
112
+
113
+ #
114
+ # 外部エンコーディング文字列化
115
+ #
116
+ def to_external_encoding
117
+ EncodingConversion.to_external_encoding(self)
118
+ end
119
+
120
+ #
121
+ # 内部エンコーディング文字列化(単項)
122
+ #
123
+ def +@
124
+ to_internal_encoding
125
+ end
126
+
127
+ #
128
+ # 外部エンコーディング文字列化(単項)
129
+ #
130
+ def -@
131
+ to_external_encoding
132
+ end
133
+ end
134
+ end
@@ -1,90 +1,90 @@
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/locales/transliteration_table'
9
-
10
- module When
11
- module Locale
12
-
13
- _IAST_Part_I = {
14
- "A" => "अ", "a" => "अ",
15
- "Ā" => "आ", "ā" => "आ",
16
- "I" => "इ", "i" => "इ",
17
- "Ī" => "ई", "ī" => "ई",
18
- "U" => "उ", "u" => "उ",
19
- "Ū" => "ऊ", "ū" => "ऊ",
20
- "Ṛ" => "ऋ", "ṛ" => "ऋ",
21
- "Ṝ" => "ॠ", "ṝ" => "ॠ",
22
- "Ḷ" => "ऌ", "ḷ" => "ऌ",
23
- "Ḹ" => "ॡ", "ḹ" => "ॡ",
24
- "E" => "ए", "e" => "ए",
25
- "Ai" => "ऐ", "ai" => "ऐ",
26
- "O" => "ओ", "o" => "ओ",
27
- "Au" => "औ", "au" => "औ",
28
- "Ṃ" => "अं", "ṃ" => "अं",
29
- "Ḥ" => "अः", "ḥ" => "अः",
30
- "'" => "अऽ",
31
-
32
- "K" => "क", "k" => "क",
33
- "C" => "च", "c" => "च",
34
- "Ṭ" => "ट", "ṭ" => "ट",
35
- "T" => "त", "t" => "त",
36
- "P" => "प", "p" => "प",
37
- "Kh" => "ख", "kh" => "ख",
38
- "Ch" => "छ", "ch" => "छ",
39
- "Ṭh" => "ठ", "ṭh" => "ठ",
40
- "Th" => "थ", "th" => "थ",
41
- "Ph" => "फ", "ph" => "फ",
42
- "G" => "ग", "g" => "ग",
43
- "J" => "ज", "j" => "ज",
44
- "Ḍ" => "ड", "ḍ" => "ड",
45
- "D" => "द", "d" => "द",
46
- "B" => "ब", "b" => "ब",
47
- "Gh" => "घ", "gh" => "घ",
48
- "Jh" => "झ", "jh" => "झ",
49
- "Ḍh" => "ढ", "ḍh" => "ढ",
50
- "Dh" => "ध", "dh" => "ध",
51
- "Bh" => "भ", "bh" => "भ",
52
- "Ṅ" => "ङ", "ṅ" => "ङ",
53
- "Ñ" => "ञ", "ñ" => "ञ",
54
- "Ṇ" => "ण", "ṇ" => "ण",
55
- "N" => "न", "n" => "न",
56
- "M" => "म", "m" => "म",
57
- "H" => "ह", "h" => "ह",
58
- "Y" => "य", "y" => "य",
59
- "R" => "र", "r" => "र",
60
- "L" => "ल", "l" => "ल",
61
- "V" => "व", "v" => "व",
62
- "Ś" => "श", "ś" => "श",
63
- "Ṣ" => "ष", "ṣ" => "ष",
64
- "S" => "स", "s" => "स"
65
- }
66
-
67
- _IAST_Part_II = {
68
- "R̥" => "ऋ", "r̥" => "ऋ",
69
- "R̥̄" => "ॠ", "r̥̄" => "ॠ",
70
- "Ē" => "ए", "ē" => "ए",
71
- "Ō" => "ओ", "ō" => "ओ",
72
- "Ṁ" => "अं", "ṁ" => "अं"
73
- }
74
-
75
- #
76
- # IAST: International Alphabet of Sanskrit Transliteration
77
- #
78
- IAST = {
79
- 'hi' => _IAST_Part_I.merge(_IAST_Part_II)
80
- }
81
-
82
- #
83
- # IASTR: International Alphabet of Sanskrit Transliteration - Reverse
84
- #
85
- IASTR = {
86
- 'hi' => _IAST_Part_I.invert
87
- }
88
-
89
- end
90
- end
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/locales/transliteration_table'
9
+
10
+ module When
11
+ module Locale
12
+
13
+ _IAST_Part_I = {
14
+ "A" => "अ", "a" => "अ",
15
+ "Ā" => "आ", "ā" => "आ",
16
+ "I" => "इ", "i" => "इ",
17
+ "Ī" => "ई", "ī" => "ई",
18
+ "U" => "उ", "u" => "उ",
19
+ "Ū" => "ऊ", "ū" => "ऊ",
20
+ "Ṛ" => "ऋ", "ṛ" => "ऋ",
21
+ "Ṝ" => "ॠ", "ṝ" => "ॠ",
22
+ "Ḷ" => "ऌ", "ḷ" => "ऌ",
23
+ "Ḹ" => "ॡ", "ḹ" => "ॡ",
24
+ "E" => "ए", "e" => "ए",
25
+ "Ai" => "ऐ", "ai" => "ऐ",
26
+ "O" => "ओ", "o" => "ओ",
27
+ "Au" => "औ", "au" => "औ",
28
+ "Ṃ" => "अं", "ṃ" => "अं",
29
+ "Ḥ" => "अः", "ḥ" => "अः",
30
+ "'" => "अऽ",
31
+
32
+ "K" => "क", "k" => "क",
33
+ "C" => "च", "c" => "च",
34
+ "Ṭ" => "ट", "ṭ" => "ट",
35
+ "T" => "त", "t" => "त",
36
+ "P" => "प", "p" => "प",
37
+ "Kh" => "ख", "kh" => "ख",
38
+ "Ch" => "छ", "ch" => "छ",
39
+ "Ṭh" => "ठ", "ṭh" => "ठ",
40
+ "Th" => "थ", "th" => "थ",
41
+ "Ph" => "फ", "ph" => "फ",
42
+ "G" => "ग", "g" => "ग",
43
+ "J" => "ज", "j" => "ज",
44
+ "Ḍ" => "ड", "ḍ" => "ड",
45
+ "D" => "द", "d" => "द",
46
+ "B" => "ब", "b" => "ब",
47
+ "Gh" => "घ", "gh" => "घ",
48
+ "Jh" => "झ", "jh" => "झ",
49
+ "Ḍh" => "ढ", "ḍh" => "ढ",
50
+ "Dh" => "ध", "dh" => "ध",
51
+ "Bh" => "भ", "bh" => "भ",
52
+ "Ṅ" => "ङ", "ṅ" => "ङ",
53
+ "Ñ" => "ञ", "ñ" => "ञ",
54
+ "Ṇ" => "ण", "ṇ" => "ण",
55
+ "N" => "न", "n" => "न",
56
+ "M" => "म", "m" => "म",
57
+ "H" => "ह", "h" => "ह",
58
+ "Y" => "य", "y" => "य",
59
+ "R" => "र", "r" => "र",
60
+ "L" => "ल", "l" => "ल",
61
+ "V" => "व", "v" => "व",
62
+ "Ś" => "श", "ś" => "श",
63
+ "Ṣ" => "ष", "ṣ" => "ष",
64
+ "S" => "स", "s" => "स"
65
+ }
66
+
67
+ _IAST_Part_II = {
68
+ "R̥" => "ऋ", "r̥" => "ऋ",
69
+ "R̥̄" => "ॠ", "r̥̄" => "ॠ",
70
+ "Ē" => "ए", "ē" => "ए",
71
+ "Ō" => "ओ", "ō" => "ओ",
72
+ "Ṁ" => "अं", "ṁ" => "अं"
73
+ }
74
+
75
+ #
76
+ # IAST: International Alphabet of Sanskrit Transliteration
77
+ #
78
+ IAST = {
79
+ 'hi' => _IAST_Part_I.merge(_IAST_Part_II)
80
+ }
81
+
82
+ #
83
+ # IASTR: International Alphabet of Sanskrit Transliteration - Reverse
84
+ #
85
+ IASTR = {
86
+ 'hi' => _IAST_Part_I.invert
87
+ }
88
+
89
+ end
90
+ end