chronic_cron 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e96a490a0772cc3fb664d21a43ff08e1c75c57313a22d5ae439e4f8a0d9afe66
4
- data.tar.gz: 7408f6ee2a8cf3b96f49df24701f497b5d9b5bb4a38589e0c16f5c89ba9ebdf3
3
+ metadata.gz: 71cb9fbaff016e7cf04a40aa56dedba54844753254825889c6e1525aa680be7b
4
+ data.tar.gz: e5b614c4fdd6c3935eb7276387206c6b1e5ed90cf84c18c1a16ef8819fd6c318
5
5
  SHA512:
6
- metadata.gz: f75d5c571167e0f57ad4af8dbd5f79597f2eed929f03d83050b9b6e8e24bd90d9aca7cad1e029c2bb768b1db7fa9e24b96f91d1a0ce866b9b25fdcc15511b460
7
- data.tar.gz: 793fdf3d0f8ba26a03450d9a8ba939f6dd8d54e472eff0c872b3793942a494b5eac98306e04866d2ebad27ef5b29ad11e407eebffd3242dd62258aff72a1bd72
6
+ metadata.gz: 2ca9ba056ab67289a9a63bfc865ab45f3d7cdf70caeb28db11c912f80e0161f6cf9aa7cf74a812c7cd5ee0372c14ca9b875c50d9321880bf29909fc1079fad5a
7
+ data.tar.gz: 067d8f29da520258af4fa0054e446084bb49cedb04260821a94f5ce0800b82ed4f9f7772f392d7d46ef7c87708dc2d3d4b1a891fe5ee9d5dbf8230351d2c34e5
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/chronic_cron.rb CHANGED
@@ -11,77 +11,77 @@ require 'timetoday'
11
11
  class ChronicCron
12
12
  include AppRoutes
13
13
  using ColouredText
14
-
15
- attr_reader :to_expression
16
-
14
+
15
+ attr_reader :to_expression
16
+
17
17
  def self.parse(s)
18
18
  r = new(s)
19
19
  r.valid? ? r : nil
20
20
  end
21
-
21
+
22
22
  def initialize(s, now=Time.now, log: nil, debug: false)
23
-
23
+
24
24
  @now, @log, @debug = now, log, debug
25
-
26
- puts ('@now: ' + @now.inspect).debug if @debug
27
-
25
+
26
+ puts ('@now: ' + @now.inspect).debug if @debug
27
+
28
28
  super()
29
29
  @params = {input: s}
30
30
  expressions(@params)
31
31
 
32
32
  if s =~ /^tomorrow/i then
33
-
33
+
34
34
  s.sub!(/^tomorrow /i,'')
35
35
  expression = find_expression(s.downcase\
36
36
  .sub(/^(?:is|on|at|from|starting)\s+/,''))
37
- @cf = CronFormat.new(expression, now)
37
+ @cf = CronFormat.new(expression, now)
38
38
  @cf.adjust_date @cf.to_time - (24 * 60 * 60)
39
-
39
+
40
40
  else
41
-
41
+
42
42
  expression = find_expression(s.downcase\
43
43
  .sub(/^(?:on|at|from|starting)\s+/,''))
44
44
  puts 'expression: ' + expression.inspect if @debug
45
45
  return unless expression
46
-
47
- @cf = CronFormat.new(expression, now)
48
-
46
+
47
+ @cf = CronFormat.new(expression, now)
48
+
49
49
  end
50
-
50
+
51
51
 
52
52
  @to_expression = @cf.to_expression
53
53
 
54
54
  end
55
-
55
+
56
56
  def inspect()
57
57
  if @cf then
58
- "#<ChronicCron:%s @to_expression=\"%s\", @to_time=\"%s\">" %
58
+ "#<ChronicCron:%s @to_expression=\"%s\", @to_time=\"%s\">" %
59
59
  [self.object_id, @to_expression, @cf.to_time]
60
60
  else
61
61
  "#<ChronicCron:%s >" % [self.object_id]
62
62
  end
63
63
  end
64
-
64
+
65
65
  def next()
66
66
  @cf.next
67
67
  end
68
-
69
- def to_date()
68
+
69
+ def to_date()
70
70
  @cf.to_time.to_date
71
71
  end
72
-
72
+
73
73
  def to_time()
74
74
  @cf.to_time
75
75
  end
76
-
76
+
77
77
  def valid?
78
78
  @cf.respond_to? :to_time
79
79
  end
80
-
80
+
81
81
  protected
82
82
 
83
- def expressions(params)
84
-
83
+ def expressions(params)
84
+
85
85
  log = @log
86
86
 
87
87
  r = '[0-9\*,\?\/\-]+'
@@ -89,83 +89,83 @@ class ChronicCron
89
89
 
90
90
  # e.g. 00 5 15 * *
91
91
  get /(#{r}\s+#{r}\s+#{r}\s#{r}\s#{r})(\s#{r})?/ do
92
-
92
+
93
93
  puts 'ChronicCron#expressions 10' if @debug
94
-
94
+
95
95
  "%s%s" % params[:captures]
96
96
  end
97
97
 
98
98
  # e.g. 9:00-18:00 every day
99
99
  get /(\d{1,2}):(\d{1,2})-(\d{1,2}):\d{1,2}\s+#{daily}/ do
100
-
100
+
101
101
  puts 'ChronicCron#expressions 20' if @debug
102
-
102
+
103
103
  "%s %s-%s * * *" % params[:captures].values_at(1,0,2)
104
- end
104
+ end
105
105
 
106
106
  # e.g. every 30mins from 8:00am until 8:00pm mon-fri
107
- get /every\s+(\d+)\s*mins\s+from\s+(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+(\w+\-\w+)/x do
107
+ get /every\s+(\d+)\s*mins\s+from\s+(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+(\w+\-\w+)/x do
108
108
  |interval_mins, r_hrs1, mins1, meridiem1, r_hrs2, meridiem2, wdays|
109
109
 
110
110
  hrs1 = meridiem1 == 'pm' ? r_hrs1.to_i + 12 : r_hrs1
111
111
  hrs2 = meridiem2 == 'pm' ? r_hrs2.to_i + 12 : r_hrs2
112
-
112
+
113
113
  puts 'ChronicCron#expressions 30' if @debug
114
-
114
+
115
115
  "%s/%s %s-%s * * %s" % [mins1.to_i, interval_mins, hrs1, hrs2, wdays]
116
- end
117
-
116
+ end
117
+
118
118
  # e.g. every 30mins from 8:00am until 8:00pm every day
119
- get /every\s+(\d+)\s*mins\s+from\s+(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+#{daily}/ do
119
+ get /every\s+(\d+)\s*mins\s+from\s+(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+#{daily}/ do
120
120
  |interval_mins, r_hrs1, mins1, meridiem1, r_hrs2, meridiem2|
121
121
  hrs1 = meridiem1 == 'pm' ? r_hrs1.to_i + 12 : r_hrs1
122
122
  hrs2 = meridiem2 == 'pm' ? r_hrs2.to_i + 12 : r_hrs2
123
-
123
+
124
124
  puts 'ChronicCron#expressions 40' if @debug
125
-
125
+
126
126
  "%s/%s %s-%s * * *" % [mins1.to_i, interval_mins, hrs1, hrs2]
127
- end
128
-
127
+ end
128
+
129
129
  # e.g. 8:00am until 8:00pm every day
130
- get /(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+#{daily}/ do
130
+ get /(\d{1,2}):(\d{1,2})([ap]m)(?:\s+until\s+|\s*-\s*)(\d{1,2}):\d{1,2}([ap]m)\s+#{daily}/ do
131
131
  |r_hrs1, mins1, meridiem1, r_hrs2, meridiem2|
132
132
  hrs1 = meridiem1 == 'pm' ? r_hrs1.to_i + 12 : r_hrs1
133
133
  hrs2 = meridiem2 == 'pm' ? r_hrs2.to_i + 12 : r_hrs2
134
-
134
+
135
135
  puts 'ChronicCron#expressions 50' if @debug
136
-
136
+
137
137
  "%s %s-%s * * *" % [mins1.to_i, hrs1, hrs2]
138
- end
138
+ end
139
139
 
140
140
  # e.g. 10:15am every day
141
141
  get /(\d{1,2}):?(\d{1,2})([ap]m)?\s+#{daily}/ do |raw_hrs, mins, meridiem|
142
142
  hrs = in24hrs(raw_hrs, meridiem)
143
-
143
+
144
144
  puts 'ChronicCron#expressions 60' if @debug
145
-
145
+
146
146
  "%s %s * * *" % [mins.to_i, hrs]
147
147
  end
148
148
 
149
149
  # e.g. at 7:30am Monday to Friday
150
- get /(\d{1,2}):?(\d{1,2})([ap]m)?\s+(\w+) to (\w+)/ do
150
+ get /(\d{1,2}):?(\d{1,2})([ap]m)?\s+(\w+) to (\w+)/ do
151
151
  |raw_hrs, mins, meridiem, wday1, wday2|
152
152
  hrs = in24hrs(raw_hrs, meridiem)
153
-
153
+
154
154
  puts 'ChronicCron#expressions 70' if @debug
155
-
155
+
156
156
  "%s %s * * %s-%s" % [mins.to_i, hrs , wday1, wday2]
157
- end
158
-
157
+ end
158
+
159
159
  # e.g. at 11:00 and 16:00 on every day
160
160
  get /(\d{1,2}):?(\d{1,2}) and (\d{1,2}):?\d{1,2} (?:on )?#{daily}/ do
161
-
161
+
162
162
  puts 'ChronicCron#expressions 80' if @debug
163
-
163
+
164
164
  "%s %s,%s * * *" % params[:captures].values_at(1,0,2)
165
165
  end
166
166
 
167
-
168
- get('hourly') {'0 * * * *'}
167
+
168
+ get('hourly') {'0 * * * *'}
169
169
  get('daily') {'0 0 * * *'}
170
170
  get('midnight') {'0 0 * * *'}
171
171
  get('weekly') {'0 0 * * 0'}
@@ -174,44 +174,44 @@ class ChronicCron
174
174
  get('annually') {'0 0 1 1 *'}
175
175
 
176
176
  weekday = '((?:mon|tue|wed|thu|fri|sat|sun)\w*)'
177
-
177
+
178
178
  # e.g. at 10:30pm on every Monday
179
- get /(\d{1,2}):?(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
180
- |raw_hrs, mins, meridiem, wday|
179
+ get /(\d{1,2}):?(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
180
+ |raw_hrs, mins, meridiem, wday|
181
181
  hrs = in24hrs(raw_hrs, meridiem)
182
-
182
+
183
183
  puts 'ChronicCron#expressions 90' if @debug
184
-
184
+
185
185
  "%s %s * * %s" % [mins, hrs , wday]
186
186
  end
187
-
187
+
188
188
  # e.g. at 10pm on every Monday
189
- get /(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
189
+ get /(\d{1,2})([ap]m)?\s+(?:on )?every #{weekday}/i do
190
190
  |raw_hrs, meridiem, wday|
191
191
  hrs = in24hrs(raw_hrs, meridiem)
192
-
192
+
193
193
  puts 'ChronicCron#expressions 100' if @debug
194
-
194
+
195
195
  "0 %s * * %s" % [hrs , wday]
196
- end
197
-
196
+ end
197
+
198
198
  # e.g. every 10 minutes
199
199
  get(/every (\d{1,2}) min(?:ute)?s?/){|mins| "*/%s * * * *" % [mins]}
200
200
  get(/every min(?:ute)?/){"* * * * *"}
201
-
201
+
202
202
  # e.g. every 2 hours
203
203
  get(/every (\d{1,2}) h(?:ou)?rs?/){|hrs| "* */%s * * *" % [hrs]}
204
204
  get(/every hour/){ "0 * * * *"}
205
-
205
+
206
206
  # e.g. every 2 days
207
207
  get(/every (\d{1,2}) days?/) do |days|
208
-
208
+
209
209
  log.info 'ChronicCron/expressions/get: r130' if log
210
210
  puts 'ChronicCron#expressions 150' if @debug
211
-
211
+
212
212
  "* * */%s * *" % [days]
213
213
  end
214
-
214
+
215
215
  get(/#{daily}/){ "0 0 * * *"}
216
216
 
217
217
  get /(?:any\s?time)?(?: today)? between (\S+) and (\S+)/ do |s1, s2|
@@ -222,12 +222,12 @@ class ChronicCron
222
222
  t
223
223
  end
224
224
  )
225
-
225
+
226
226
  puts 'ChronicCron#expressions 170' if @debug
227
-
227
+
228
228
  "%s %s %s %s *" % TimeToday.between(s1,s2).to_a[1..4]
229
229
  end
230
-
230
+
231
231
  get /any\s?time today/ do
232
232
  self.instance_eval %q(
233
233
  def next()
@@ -237,10 +237,10 @@ class ChronicCron
237
237
  end
238
238
  )
239
239
  puts 'ChronicCron#expressions 180' if @debug
240
-
240
+
241
241
  "%s %s %s %s *" % TimeToday.future.to_a[1..4]
242
242
  end
243
-
243
+
244
244
  # e.g. first thursday of each month at 7:30pm
245
245
  nday = '(\w+(?:st|rd|nd))\s+' + weekday + '\s+'
246
246
  get /#{nday}(?:of\s+)?(?:the|each|every)\s+month(?:\s+at\s+([^\s]+))?/i do
@@ -249,9 +249,9 @@ class ChronicCron
249
249
  month = @now.month
250
250
 
251
251
  h = {
252
- /first|1st/i => '1-7',
253
- /second|2nd/i => '8-14',
254
- /third|3rd/i => '15-21',
252
+ /first|1st/i => '1-7',
253
+ /second|2nd/i => '8-14',
254
+ /third|3rd/i => '15-21',
255
255
  /fourth|4th|last/i => '22-28'
256
256
  }
257
257
 
@@ -262,80 +262,80 @@ class ChronicCron
262
262
  raw_time ||= '6:00am'
263
263
 
264
264
  minute, hour = Chronic.parse(raw_time).to_a[1,2]
265
-
265
+
266
266
  puts 'ChronicCron#expressions 190' if @debug
267
-
267
+
268
268
  "%s %s %s * %s" % [minute, hour, day_range, wday]
269
269
 
270
270
  end
271
-
271
+
272
272
  # e.g. every tuesday at 4pm
273
273
  get /every\s+#{weekday}\s+(?:at\s+)?(\d{1,2})([ap]m)/i do
274
274
  |wday, raw_hrs, meridiem, |
275
275
 
276
- hrs = in24hrs(raw_hrs, meridiem)
277
-
276
+ hrs = in24hrs(raw_hrs, meridiem)
277
+
278
278
  puts 'ChronicCron#expressions 200' if @debug
279
-
279
+
280
280
  "0 %s * * %s" % [hrs , Date::DAYNAMES.index(wday.capitalize)]
281
281
  end
282
-
283
-
282
+
283
+
284
284
  # e.g. last sunday of March at 1am
285
-
285
+
286
286
  get /last (#{Date::DAYNAMES.join('|')}) (?:of|in) \
287
287
  (#{Date::MONTHNAMES[1..-1].join('|')})\s+at\s+(\d{1,2})(?::(\d{1,2}))?\
288
288
  ([ap]m)/i do |day, month, raw_hrs, mins, meridiem|
289
289
 
290
290
  now = Chronic.parse(month, now: @now)
291
291
  puts ('now: ' + now.inspect).debug if @debug
292
-
292
+
293
293
  d = last_wdayofmonth(day, now)
294
294
  puts ('d: ' + d.inspect).debug if @debug
295
295
 
296
296
  hrs = in24hrs(raw_hrs, meridiem)
297
-
297
+
298
298
  puts 'ChronicCron#expressions 210' if @debug
299
-
299
+
300
300
  "%s %s %s %s *" % [mins.to_i, hrs, d.day, d.month]
301
301
  end
302
-
302
+
303
303
  # e.g. last sunday of October
304
-
304
+
305
305
  get /last (#{Date::DAYNAMES.join('|')}) (?:of|in) \
306
306
  (#{Date::MONTHNAMES[1..-1].join('|')})/i do |day, month|
307
307
 
308
308
  now = Chronic.parse(month, now: @now)
309
309
 
310
310
  d = last_wdayofmonth(day, now)
311
-
311
+
312
312
  puts 'ChronicCron#expressions 220' if @debug
313
-
313
+
314
314
  "* * %s %s *" % [d.day, d.month]
315
315
  end
316
-
316
+
317
317
 
318
318
  # e.g. every 2nd tuesday at 4:40pm
319
319
  get /every\s+2nd\s+#{weekday}\s+at\s+(\d{1,2})(?::(\d{1,2}))?([ap]m)/i do
320
320
  |wday, raw_hrs, mins, meridiem, |
321
321
  hrs = in24hrs(raw_hrs, meridiem)
322
- log.info 'ChronicCron/expressions/get: r230' if log
323
-
324
- puts 'ChronicCron#expressions 220' if @debug
325
-
322
+ log.info 'ChronicCron/expressions/get: r225' if log
323
+
324
+ puts 'ChronicCron#expressions 225' if @debug
325
+
326
326
  "%s %s * * %s/2" % [mins.to_i, hrs , wday]
327
- end
328
-
327
+ end
328
+
329
329
  # e.g. every tuesday at 4:40pm
330
330
  get /every\s+#{weekday}\s+at\s+(\d{1,2}):(\d{1,2})([ap]m)/i do
331
331
  |wday, raw_hrs, mins, meridiem, |
332
332
  hrs = in24hrs(raw_hrs, meridiem)
333
-
333
+
334
334
  puts 'ChronicCron#expressions 230' if @debug
335
-
335
+
336
336
  "%s %s * * %s" % [mins, hrs , wday]
337
- end
338
-
337
+ end
338
+
339
339
 
340
340
  # e.g. every 2nd week at 6am starting from 7th Jan
341
341
  get /every 2nd week\s+at\s+([^\s]+)/ do |raw_time|
@@ -343,20 +343,20 @@ class ChronicCron
343
343
  t = Chronic.parse(raw_time, :now => @now)
344
344
  log.info 'ChronicCron/expressions/get: r250' if log
345
345
  puts 'ChronicCron#expressions 240' if @debug
346
-
346
+
347
347
  "%s %s * * %s/2" % [t.min,t.hour,t.wday]
348
348
 
349
- end
350
-
351
-
349
+ end
350
+
351
+
352
352
  # e.g. every 2nd monday
353
353
  get /every 2nd #{weekday}/ do |wday|
354
354
 
355
355
  puts 'ChronicCron#expressions 250' if @debug
356
356
  "* * * * %s/2" % [wday]
357
357
 
358
- end
359
-
358
+ end
359
+
360
360
 
361
361
  # e.g. every 2 weeks (starting 7th Jan 2020)
362
362
  get /^every (\w+) weeks \(starting ([^\)]+)/ do |interval, raw_date|
@@ -365,19 +365,19 @@ class ChronicCron
365
365
  puts ('raw_date: ' + raw_date.inspect).debug
366
366
  puts ('now: ' + @now.inspect).debug
367
367
  end
368
-
368
+
369
369
  t = raw_date ? Chronic.parse(raw_date, :now => @now) : @now
370
370
  t += WEEK * interval.to_i until t > @now
371
371
  mins, hrs = t.to_a.values_at(1,2)
372
-
373
- log.info 'ChronicCron/expressions/get: r260' if log
372
+
373
+ log.info 'ChronicCron/expressions/get: r260' if log
374
374
  if @debug then
375
375
  puts 'ChronicCron#expressions 260'
376
376
  puts ('t: ' + t.inspect).debug
377
377
  end
378
378
 
379
379
  "%s %s * * %s/%s" % [mins, hrs, t.wday, interval]
380
- end
380
+ end
381
381
 
382
382
  # e.g. every 2 weeks at 6am starting from 7th Jan
383
383
  get /^every (\w+) weeks(?:\s+at\s+([^\s]+))?/ do |interval, raw_time|
@@ -386,19 +386,19 @@ class ChronicCron
386
386
  puts ('raw_time: ' + raw_time.inspect).debug
387
387
  puts ('now: ' + @now.inspect).debug
388
388
  end
389
-
389
+
390
390
  t = raw_time ? Chronic.parse(raw_time, :now => @now) : @now
391
391
  t += WEEK * interval.to_i until t > @now
392
392
  mins, hrs = t.to_a.values_at(1,2)
393
-
394
- log.info 'ChronicCron/expressions/get: r270' if log
393
+
394
+ log.info 'ChronicCron/expressions/get: r270' if log
395
395
  if @debug then
396
396
  puts 'ChronicCron#expressions 270'
397
397
  puts ('t: ' + t.inspect).debug
398
398
  end
399
399
 
400
400
  "%s %s * * %s/%s" % [mins, hrs, t.wday, interval]
401
- end
401
+ end
402
402
 
403
403
 
404
404
  # e.g. starting 05-Aug@15:03 every 2 weeks
@@ -407,19 +407,19 @@ class ChronicCron
407
407
  t = Chronic.parse(raw_date, :now => @now)
408
408
  mins, hrs = t.to_a.values_at(1,2)
409
409
  puts 'ChronicCron#expressions 280' if @debug
410
-
410
+
411
411
  "%s %s * * %s/%s" % [mins, hrs, t.wday, interval]
412
- end
413
-
412
+ end
413
+
414
414
  # e.g. from 05-Aug@12:34 fortnightly
415
415
  get /(.*)\s+(?:biweekly|fortnightly)/ do |raw_date|
416
416
 
417
417
  t = Chronic.parse(raw_date, :now => @now)
418
418
  mins, hrs, day, month, year = t.to_a.values_at(1,2,3,4,5)
419
419
  puts 'ChronicCron#expressions 290' if @debug
420
-
420
+
421
421
  "%s %s %s %s %s/2 %s" % [mins, hrs, day, month, t.wday, year]
422
- end
422
+ end
423
423
 
424
424
  # e.g. from 06-Aug@1pm every week
425
425
  get /(.*)\s+(?:weekly|every week)/ do |raw_date|
@@ -427,18 +427,18 @@ class ChronicCron
427
427
  t = Chronic.parse(raw_date, :now => @now)
428
428
  mins, hrs, day, month, year = t.to_a.values_at(1,2,3,4,5)
429
429
  puts 'ChronicCron#expressions 300' if @debug
430
-
430
+
431
431
  "%s %s %s %s %s %s" % [mins, hrs, day, month, t.wday, year]
432
- end
433
-
432
+ end
433
+
434
434
  # e.g. every sunday
435
435
  get /every\s+#{weekday}/ do |wday|
436
-
436
+
437
437
  puts 'ChronicCron#expressions 310' if @debug
438
-
438
+
439
439
  "0 12 * * %s" % wday
440
- end
441
-
440
+ end
441
+
442
442
  # e.g. 04-Aug@12:34
443
443
  get '*' do
444
444
 
@@ -452,29 +452,31 @@ class ChronicCron
452
452
 
453
453
  def in24hrs(raw_hrs, meridiem)
454
454
 
455
+ puts 'raw_hrs: ' + raw_hrs.inspect if @debug
456
+
455
457
  hrs = if meridiem == 'pm' then
456
- raw_hrs.to_i + 12
458
+ raw_hrs.to_i < 12 ? raw_hrs.to_i + 12 : raw_hrs.to_i
457
459
  else
458
460
  raw_hrs.to_i == 12 ? 0 : raw_hrs
459
461
  end
460
- end
462
+ end
461
463
  end
462
-
463
-
464
+
465
+
464
466
  alias find_expression run_route
465
-
467
+
466
468
  private
467
-
469
+
468
470
  def last_wdayofmonth(day, now)
469
-
471
+
470
472
  wday = Date::DAYNAMES.map(&:downcase).index(day)
471
473
 
472
474
  d2 = Date.today
473
475
  date = Date.civil(now.year, now.month, -1)
474
- date -= 1 until date.wday == wday
475
-
476
+ date -= 1 until date.wday == wday
477
+
476
478
  return date
477
-
479
+
478
480
  end
479
-
481
+
480
482
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chronic_cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Yot8KuDDSCrW7txuQr8nBdP8TtGBceStvkqoqSGvzsppfoAzykAkc8zujoN1s8d2
36
36
  ioSUG4tmSnO/l+mykryWcbFA
37
37
  -----END CERTIFICATE-----
38
- date: 2021-02-23 00:00:00.000000000 Z
38
+ date: 2022-02-02 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: app-routes
@@ -118,7 +118,7 @@ dependencies:
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0.2'
120
120
  description:
121
- email: james@jamesrobertson.eu
121
+ email: digital.robertson@gmail.com
122
122
  executables: []
123
123
  extensions: []
124
124
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file