coligny 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coligny/version.rb +1 -1
- data/lib/coligny.rb +93 -30
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ac5981b5527fd98ba326d0b53e0dae72310da8
|
4
|
+
data.tar.gz: 6a1fcf9eb2becbe38cf7f81dffcfbaf05eb9d467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05115bf556215f51a3cbf056dccea82331fe59b454a65b042a585a019c53452c69aa7ccdcd15548ad35bb6b7ccd2d1aa101d20450e082c1d454966cff19473a7
|
7
|
+
data.tar.gz: 478d163555fc3c27f00a273888ad48a1f34e41b354c57babcc49b28531243520a177377bdf0ad194cb64cb7af8309675a448c55d08caa8f66942b87c19112ddd
|
data/lib/coligny/version.rb
CHANGED
data/lib/coligny.rb
CHANGED
@@ -62,8 +62,24 @@ module Coligny
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
def year_difference
|
66
|
+
if @is_metonic
|
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
|
+
|
65
81
|
def populate_saturn_earlier_equos
|
66
|
-
if (
|
82
|
+
if (year_difference % 5 == 1) || (year_difference % 5 == 0)
|
67
83
|
@months.insert(8, ColignyMonth.new("Equos", 30))
|
68
84
|
else
|
69
85
|
@months.insert(8, ColignyMonth.new("Equos", 29))
|
@@ -71,15 +87,15 @@ module Coligny
|
|
71
87
|
end
|
72
88
|
|
73
89
|
def populate_saturn_earlier_int
|
74
|
-
if (
|
90
|
+
if (year_difference % 5 == 0) && (year_difference % 30 != 5)
|
75
91
|
@months.unshift(ColignyMonth.new("Intercalary One", 29))
|
76
|
-
elsif (
|
92
|
+
elsif (year_difference % 5 == 3)
|
77
93
|
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
78
94
|
end
|
79
95
|
end
|
80
96
|
|
81
97
|
def populate_saturn_later_equos
|
82
|
-
if (
|
98
|
+
if (year_difference % 5 == 0) || (year_difference % 5 == 4)
|
83
99
|
@months.insert(8, ColignyMonth.new("Equos", 30))
|
84
100
|
else
|
85
101
|
@months.insert(8, ColignyMonth.new("Equos", 29))
|
@@ -87,15 +103,31 @@ module Coligny
|
|
87
103
|
end
|
88
104
|
|
89
105
|
def populate_saturn_later_int
|
90
|
-
if (
|
106
|
+
if (year_difference % 5 == 0)
|
91
107
|
@months.unshift(ColignyMonth.new("Intercalary One", 29))
|
92
|
-
elsif (
|
108
|
+
elsif (year_difference % 5 == 2) && (year_difference % 30 != 27)
|
93
109
|
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
94
110
|
end
|
95
111
|
end
|
96
112
|
|
113
|
+
def identify_year_locator(difference, years_between_instances)
|
114
|
+
if @is_early
|
115
|
+
if ((year_difference) % difference >= years_between_instances) || ((year_difference) % difference == 0)
|
116
|
+
return true
|
117
|
+
else
|
118
|
+
return false
|
119
|
+
end
|
120
|
+
else
|
121
|
+
if ((year_difference) % difference <= years_between_instances)
|
122
|
+
return true
|
123
|
+
else
|
124
|
+
return false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
97
129
|
def saturn_cycle_check(difference, years_between_instances, cycle, cycle_remainder)
|
98
|
-
if (
|
130
|
+
if identify_year_locator(difference, years_between_instances) && ((year_difference) >= difference) && ((year_difference) & cycle == cycle_remainder)
|
99
131
|
return true
|
100
132
|
else
|
101
133
|
return false
|
@@ -114,11 +146,26 @@ module Coligny
|
|
114
146
|
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
115
147
|
end
|
116
148
|
end
|
117
|
-
|
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
|
+
def saturn_reverse_longcycle_int2_check
|
158
|
+
if saturn_cycle_check(635, 606, 30, 3)
|
159
|
+
@months.insert(6, ColignyMonth.new("Intercalary Two", 30))
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
118
163
|
def populate_saturn_months
|
119
164
|
if @is_early
|
120
165
|
populate_saturn_earlier_equos
|
121
166
|
populate_saturn_earlier_int
|
167
|
+
saturn_reverse_longcycle_equos_check
|
168
|
+
saturn_reverse_longcycle_int2_check
|
122
169
|
else
|
123
170
|
populate_saturn_later_equos
|
124
171
|
populate_saturn_later_int
|
@@ -129,7 +176,7 @@ module Coligny
|
|
129
176
|
|
130
177
|
def test_against_cases(cases)
|
131
178
|
cases.each do |test|
|
132
|
-
if (
|
179
|
+
if (year_difference % 19) == test
|
133
180
|
return true
|
134
181
|
end
|
135
182
|
end
|
@@ -153,32 +200,23 @@ module Coligny
|
|
153
200
|
|
154
201
|
return test_against_cases(cases)
|
155
202
|
end
|
156
|
-
|
157
|
-
def earlier_than_start_date_test_cases(cases)
|
158
|
-
cases.each do |test|
|
159
|
-
if ((3035 - @year) % 19) == test
|
160
|
-
return true
|
161
|
-
end
|
162
|
-
end
|
163
|
-
return false
|
164
|
-
end
|
165
|
-
|
203
|
+
|
166
204
|
def test_earlier_than_start_equos_days_metonic
|
167
205
|
cases = [1,5,6,10,11,15,16]
|
168
206
|
|
169
|
-
return
|
207
|
+
return test_against_cases(cases)
|
170
208
|
end
|
171
209
|
|
172
210
|
def test_earlier_than_start_date_intone_metonic
|
173
211
|
cases = [5,10,15]
|
174
212
|
|
175
|
-
return
|
213
|
+
return test_against_cases(cases)
|
176
214
|
end
|
177
215
|
|
178
216
|
def test_earlier_than_start_date_inttwo_metonic
|
179
217
|
cases = [3,8,13,18]
|
180
218
|
|
181
|
-
return
|
219
|
+
return test_against_cases(cases)
|
182
220
|
end
|
183
221
|
|
184
222
|
def populate_metonic_equos
|
@@ -201,20 +239,42 @@ module Coligny
|
|
201
239
|
end
|
202
240
|
end
|
203
241
|
|
242
|
+
def metonic_longcycle_year_check(frequency_of_adjustment, case_limiter)
|
243
|
+
if @is_early
|
244
|
+
if ((year_difference % frequency_of_adjustment >= case_limiter) || (year_difference % frequency_of_adjustment == 0)) && (year_difference >= frequency_of_adjustment)
|
245
|
+
return true
|
246
|
+
else
|
247
|
+
return false
|
248
|
+
end
|
249
|
+
else
|
250
|
+
if (year_difference % frequency_of_adjustment <= case_limiter) && (year_difference >= frequency_of_adjustment)
|
251
|
+
return true
|
252
|
+
else
|
253
|
+
return false
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
204
258
|
def metonic_longcycle_int2_check
|
205
|
-
if (
|
259
|
+
if metonic_longcycle_year_check(6569, 4) && (@months[6].name = "Intercalary Two")
|
206
260
|
@months.delete_at(6)
|
207
261
|
end
|
208
262
|
end
|
209
263
|
|
210
|
-
def
|
211
|
-
|
212
|
-
|
213
|
-
|
264
|
+
def metonic_longcycle_equos_check
|
265
|
+
if metonic_longcycle_year_check(61, 4) && test_earlier_than_start_date_inttwo_metonic
|
266
|
+
@months.find { |s| s.name == "Equos" }.days = 29
|
267
|
+
end
|
214
268
|
end
|
215
269
|
|
216
|
-
def
|
217
|
-
if (
|
270
|
+
def metonic_longcycle_reverse_int2_check
|
271
|
+
if metonic_longcycle_year_check(6569, 6565) && (@months[6].name = "Intercalary Two")
|
272
|
+
@months.delete_at(6)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
def metonic_longcycle_reverse_equos_check
|
277
|
+
if metonic_longcycle_year_check(61, 57) && test_inttwo_metonic
|
218
278
|
@months.find { |s| s.name == "Equos" }.days = 29
|
219
279
|
end
|
220
280
|
end
|
@@ -224,7 +284,10 @@ module Coligny
|
|
224
284
|
populate_metonic_int1
|
225
285
|
populate_metonic_int2
|
226
286
|
|
227
|
-
if @
|
287
|
+
if @is_early
|
288
|
+
metonic_longcycle_reverse_int2_check
|
289
|
+
metonic_longcycle_reverse_equos_check
|
290
|
+
else
|
228
291
|
metonic_longcycle_int2_check
|
229
292
|
metonic_longcycle_equos_check
|
230
293
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coligny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Krusen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|