fugit 1.4.4 → 1.4.5

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: 396cc931521c222b522a89e3840d3e1bd42e0927f20d5d3f0532122eafd62f74
4
- data.tar.gz: a04d54cd9894c593674031f704133f825769438e85a91330baaa42ad27089d68
3
+ metadata.gz: e49e2002591b450a853f0a27eb942fd69f69a59d6803c229bcdb51af471b6862
4
+ data.tar.gz: f9f6921007e4e0df0908e63f080d0f710ba60401299440347ecc994b6ccf56fc
5
5
  SHA512:
6
- metadata.gz: e97aebd235b532d3ad3a3df969b7189d1e628c3e1229d9d8d5a89b48fd552ebd856faf203289e9171df9b32e7a79b89ff33675799b83c6381eafc1f61945605e
7
- data.tar.gz: eaaed3254216b7082d8715990768d6b6588a864899e6911f74e967dfa83ed93221032420f82bd3f7215536365ee9340b2f2f6a2e175826456c9367d80d3ed9c4
6
+ metadata.gz: 22dc41bcc969d3505157572bbe899d7f160f8ab06ce42b3f4b494911ae69d96bde4be7422f55fd31c33491899b3af4ec50b4870f419145d103bd230d94affecd
7
+ data.tar.gz: 50d62627a4ed4fe54cf31d2901eebdd56f57a69f0464f0ede436184af604d1d18622e3159b487f9a92a35cfbf8a3ed65b58887dc3f43514e86a73e4db5d11692
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.4.5 released 2021-04-22
6
+
7
+ * Accept "* * * Mon%2+2", gh-47
8
+
9
+
5
10
  ## fugit 1.4.4 released 2021-03-25
6
11
 
7
12
  * Ensure leaving ZH DST is OK, gh-53
data/CREDITS.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  # fugit credits
3
3
 
4
+ * Karen Sawrey https://github.com/karensawrey gh-47, Mon%2+1 rework idea
4
5
  * Olle Jonsson https://github.com/olleolleolle gha Ruby 3.0
5
6
  * Andy Pfister https://github.com/andyundso gh-53, entering DST
6
7
  * Solteszad https://github.com/solteszad gh-51, fix previous_time vs last day of month
@@ -11,7 +12,7 @@
11
12
  * Danny Ben Shitrit https://github.com/DannyBen nat variants, gh-38
12
13
  * Dominik Sander https://github.com/dsander #rough_frequency 0, gh-36
13
14
  * Milovan Zogovic https://github.com/assembler Cron#match? vs TZ, gh-31
14
- * Jessica Stokes https://github.com/ticky 0-24 issue with cron, gh-30
15
+ * Jessica Stokes https://github.com/ticky 0-24 issue with cron, gh-30 and gh-47
15
16
  * Shai Coleman https://github.com/shaicoleman parse_nat enhancements, gh-24, gh-25, gh-28, and gh-37
16
17
  * Jan Stevens https://github.com/JanStevens Fugit.parse('every 15 minutes') gh-22
17
18
  * Fabio Pitino https://github.com/hspazio nil on February 30 gh-21
data/README.md CHANGED
@@ -203,8 +203,22 @@ p EtOrbi.parse('2019-01-01').rweek % 2 # => 1
203
203
  p EtOrbi.parse('2019-04-11').wday # => 4
204
204
  p EtOrbi.parse('2019-04-11').rweek # => 15
205
205
  p EtOrbi.parse('2019-04-11').rweek % 2 # => 1
206
+
207
+ c = Fugit.parse('* * * * tue%2')
208
+ c.match?('2019-01-01') # => false, since rweek % 2 == 1
209
+ c.match?('2019-01-08') # => true, since rweek % 2 == 0
210
+
211
+ c = Fugit.parse('* * * * tue%2+1')
212
+ c.match?('2019-01-01') # => true, since (rweek + 1) % 2 == 0
213
+ c.match?('2019-01-08') # => false, since (rweek + 1) % 2 == 1
214
+
215
+ # ...
206
216
  ```
207
217
 
218
+ `sun%2` matches if Sunday and `current_date.rweek % 2 == 0`
219
+ `tue%3+2` matches if Tuesday and `current_date.rweek + 2 % 3 == 0`
220
+ `tue%x+y` matches if Tuesday and `current_date.rweek + y % x == 0`
221
+
208
222
 
209
223
  ## `Fugit::Duration`
210
224
 
data/lib/fugit.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Fugit
4
4
 
5
- VERSION = '1.4.4'
5
+ VERSION = '1.4.5'
6
6
  end
7
7
 
8
8
  require 'time'
data/lib/fugit/cron.rb CHANGED
@@ -150,7 +150,7 @@ module Fugit
150
150
 
151
151
  def weekday_modulo_match?(nt, mod)
152
152
 
153
- nt.rweek % mod[0] == mod[1]
153
+ (nt.rweek + mod[1]) % mod[0] == 0
154
154
  end
155
155
 
156
156
  def weekday_match?(nt)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fugit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro