coligny 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/coligny/version.rb +1 -1
- data/lib/coligny.rb +57 -64
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4f92c2525cbed0013f9d1e231750a273b95c72a
|
4
|
+
data.tar.gz: 83b315694b856f5f6a42d6f45b8129e219e1ce55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9575a9406579430ed4602abff45596eb2d7ac526c5d67009b11c4cbf22c217567a6404960eb7edfce60618ecabe2da022ee20dc0ec81feb4412db4e95d93f0aa
|
7
|
+
data.tar.gz: 6db4c853da184705765d8bb078c6c15532e3d2fc83661c7503b2a80a11ee98a6f351eb9c1215607205d075638c279ada97723909fd2cd9b9469d788c7f898717
|
data/README.md
CHANGED
@@ -9,9 +9,8 @@ This gem is intended to provide a resource for the use of the Coligny Calendar,
|
|
9
9
|
|
10
10
|
##To-DO
|
11
11
|
|
12
|
-
- Finish long-cycle checks for dates earlier than cycle start dates.
|
13
12
|
- Refactor populate methods for 30-year cycle
|
14
|
-
- Add Inscriptions for dates
|
13
|
+
- Add Inscriptions for dates(?)
|
15
14
|
- Comments
|
16
15
|
|
17
16
|
## Installation
|
data/lib/coligny/version.rb
CHANGED
data/lib/coligny.rb
CHANGED
@@ -64,52 +64,52 @@ module Coligny
|
|
64
64
|
|
65
65
|
def year_difference
|
66
66
|
if @is_metonic
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
def
|
82
|
-
if
|
67
|
+
if @is_early
|
68
|
+
return 3035 - @year
|
69
|
+
else
|
70
|
+
return @year - 3035
|
71
|
+
end
|
72
|
+
else
|
73
|
+
if @is_early
|
74
|
+
return 3034 - @year
|
75
|
+
else
|
76
|
+
return @year - 3034
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def populate_saturn_equos
|
82
|
+
if @is_early
|
83
|
+
if (year_difference % 5 == 1) || (year_difference % 5 == 0)
|
84
|
+
@months.insert(8, ColignyMonth.new("Equos", 30))
|
85
|
+
end
|
86
|
+
elsif (year_difference % 5 == 0) || (year_difference % 5 == 4)
|
83
87
|
@months.insert(8, ColignyMonth.new("Equos", 30))
|
84
88
|
else
|
85
89
|
@months.insert(8, ColignyMonth.new("Equos", 29))
|
86
90
|
end
|
87
91
|
end
|
88
92
|
|
89
|
-
def
|
90
|
-
if
|
93
|
+
def populate_saturn_int1
|
94
|
+
if year_difference % 5 == 0
|
91
95
|
@months.unshift(ColignyMonth.new("Intercalary One", 29))
|
92
|
-
elsif (year_difference % 5 == 3)
|
93
|
-
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
97
|
-
def
|
98
|
-
if (year_difference %
|
99
|
-
|
99
|
+
def populate_saturn_int2_check(cycle_repeat, cycle_limit, exception_cycle, exception_limit)
|
100
|
+
if (year_difference % cycle_repeat == cycle_limit) && (year_difference % exception_cycle != exception_limit)
|
101
|
+
return true
|
100
102
|
else
|
101
|
-
|
103
|
+
return false
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
105
|
-
def
|
106
|
-
if (
|
107
|
-
@months.unshift(ColignyMonth.new("Intercalary One", 29))
|
108
|
-
elsif (year_difference % 5 == 2) && (year_difference % 30 != 27)
|
107
|
+
def populate_saturn_int2
|
108
|
+
if (@is_early && populate_saturn_int2_check(5, 3, 30, 3)) || (!@is_early && populate_saturn_int2_check(5, 2, 30, 27))
|
109
109
|
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
110
110
|
end
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
def identify_year_locator(difference, years_between_instances)
|
114
114
|
if @is_early
|
115
115
|
if ((year_difference) % difference >= years_between_instances) || ((year_difference) % difference == 0)
|
@@ -135,7 +135,7 @@ module Coligny
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def saturn_longcycle_equos_check
|
138
|
-
if saturn_cycle_check(198, 4, 5, 4)
|
138
|
+
if (@is_early && saturn_cycle_check(198, 194, 5, 1)) || (!@is_early && saturn_cycle_check(198, 4, 5, 4))
|
139
139
|
equos = @months.find { |s| s.name == "Equos" }
|
140
140
|
equos.days = 29
|
141
141
|
end
|
@@ -147,29 +147,21 @@ module Coligny
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
def saturn_reverse_longcycle_equos_check
|
151
|
-
if saturn_cycle_check(198, 194, 5, 1)
|
152
|
-
equos = @months.find { |s| s.name == "Equos" }
|
153
|
-
equos.days = 29
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
150
|
def saturn_reverse_longcycle_int2_check
|
158
151
|
if saturn_cycle_check(635, 606, 30, 3)
|
159
152
|
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
160
153
|
end
|
161
154
|
end
|
162
155
|
|
163
|
-
def populate_saturn_months
|
156
|
+
def populate_saturn_months
|
157
|
+
populate_saturn_equos
|
158
|
+
populate_saturn_int1
|
159
|
+
populate_saturn_int2
|
160
|
+
saturn_longcycle_equos_check
|
161
|
+
|
164
162
|
if @is_early
|
165
|
-
populate_saturn_earlier_equos
|
166
|
-
populate_saturn_earlier_int
|
167
|
-
saturn_reverse_longcycle_equos_check
|
168
163
|
saturn_reverse_longcycle_int2_check
|
169
164
|
else
|
170
|
-
populate_saturn_later_equos
|
171
|
-
populate_saturn_later_int
|
172
|
-
saturn_longcycle_equos_check
|
173
165
|
saturn_longcycle_int2_check
|
174
166
|
end
|
175
167
|
end
|
@@ -239,19 +231,27 @@ module Coligny
|
|
239
231
|
end
|
240
232
|
end
|
241
233
|
|
234
|
+
def metonic_longcycle_early_year_check(frequency_of_adjustment, case_limiter)
|
235
|
+
if ((year_difference % frequency_of_adjustment >= case_limiter) || (year_difference % frequency_of_adjustment == 0)) && (year_difference >= frequency_of_adjustment)
|
236
|
+
return true
|
237
|
+
else
|
238
|
+
return false
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def metonic_longcycle_late_year_check(frequency_of_adjustment, case_limiter)
|
243
|
+
if (year_difference % frequency_of_adjustment <= case_limiter) && (year_difference >= frequency_of_adjustment)
|
244
|
+
return true
|
245
|
+
else
|
246
|
+
return false
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
242
250
|
def metonic_longcycle_year_check(frequency_of_adjustment, case_limiter)
|
243
251
|
if @is_early
|
244
|
-
|
245
|
-
return true
|
246
|
-
else
|
247
|
-
return false
|
248
|
-
end
|
252
|
+
return metonic_longcycle_early_year_check(frequency_of_adjustment, case_limiter)
|
249
253
|
else
|
250
|
-
|
251
|
-
return true
|
252
|
-
else
|
253
|
-
return false
|
254
|
-
end
|
254
|
+
return metonic_longcycle_late_year_check(frequency_of_adjustment, case_limiter)
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
@@ -262,7 +262,7 @@ module Coligny
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def metonic_longcycle_equos_check
|
265
|
-
if metonic_longcycle_year_check(61, 4) && test_earlier_than_start_date_inttwo_metonic
|
265
|
+
if (metonic_longcycle_year_check(61, 4) && test_earlier_than_start_date_inttwo_metonic) || (metonic_longcycle_year_check(61, 57) && test_inttwo_metonic)
|
266
266
|
@months.find { |s| s.name == "Equos" }.days = 29
|
267
267
|
end
|
268
268
|
end
|
@@ -273,23 +273,16 @@ module Coligny
|
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
276
|
-
def metonic_longcycle_reverse_equos_check
|
277
|
-
if metonic_longcycle_year_check(61, 57) && test_inttwo_metonic
|
278
|
-
@months.find { |s| s.name == "Equos" }.days = 29
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
276
|
def populate_metonic_months
|
283
277
|
populate_metonic_equos
|
284
278
|
populate_metonic_int1
|
285
279
|
populate_metonic_int2
|
280
|
+
metonic_longcycle_equos_check
|
286
281
|
|
287
282
|
if @is_early
|
288
283
|
metonic_longcycle_reverse_int2_check
|
289
|
-
metonic_longcycle_reverse_equos_check
|
290
284
|
else
|
291
|
-
metonic_longcycle_int2_check
|
292
|
-
metonic_longcycle_equos_check
|
285
|
+
metonic_longcycle_int2_check
|
293
286
|
end
|
294
287
|
end
|
295
288
|
end
|