fugit 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/CREDITS.md +1 -0
- data/README.md +5 -1
- data/lib/fugit.rb +1 -1
- data/lib/fugit/cron.rb +5 -7
- data/lib/fugit/duration.rb +4 -4
- data/lib/fugit/misc.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30b1280ebc1d629dbbdcba1b02718a535b0fdec70c9d690f3d5208181ffe4577
|
4
|
+
data.tar.gz: 918af2ece3f4c94eb1145b60da397a43ee574023831bae4b7c0b95e6a97e389b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b8ad132efdd2b9be99fb9fd1ab6f505024fd309865cf007d9ade6df20207a4165e49679a4113614010f7436ddbf28e2fc6ecbdbbedc713bb3e4def3f2b03ca
|
7
|
+
data.tar.gz: 4fc6e3a8f080b698151cc6dadfb1d2869cb736a4e6c60ce7fe6c26a598f83b693d32f37edd1f42cd20dd0efdb47dd04cde097fca07d0bf5fe6eb9412b72ef0cf
|
data/CHANGELOG.md
CHANGED
data/CREDITS.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
# fugit credits
|
3
3
|
|
4
|
+
* Andy Pfister https://github.com/andyundso gh-53, entering DST
|
4
5
|
* Solteszad https://github.com/solteszad gh-51, fix previous_time vs last day of month
|
5
6
|
* Niklas https://github.com/gr8bit gh-49, Fugit::Cron.parse('')
|
6
7
|
* Matsuda Akira https://github.com/amatsuda gh-46, warning suppression
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
# fugit
|
3
3
|
|
4
|
-
[![
|
4
|
+
[![tests](https://github.com/floraison/fugit/workflows/test/badge.svg)](https://github.com/floraison/fugit/actions)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/fugit.svg)](http://badge.fury.io/rb/fugit)
|
6
6
|
[![Join the chat at https://gitter.im/floraison/fugit](https://badges.gitter.im/floraison/fugit.svg)](https://gitter.im/floraison/fugit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
7
7
|
|
@@ -350,6 +350,10 @@ Fugit::Nat.parse('every day at 16:15 nada 18:30', multi: true)
|
|
350
350
|
|
351
351
|
`multi: false` is the default behaviour, return a single `Fugit::Cron` instance or nil when it cannot parse.
|
352
352
|
|
353
|
+
### Nat Midnight
|
354
|
+
|
355
|
+
`"Every day at midnight"` is supported, but `"Every monday at midnight"` will be interpreted (as of Fugit <= 1.4.x) as `"Every monday at 00:00"`. Sorry about that.
|
356
|
+
|
353
357
|
|
354
358
|
## LICENSE
|
355
359
|
|
data/lib/fugit.rb
CHANGED
data/lib/fugit/cron.rb
CHANGED
@@ -79,10 +79,7 @@ module Fugit
|
|
79
79
|
%w[ year month day wday hour min sec wday_in_month rweek rday ]
|
80
80
|
.collect(&:to_sym).each { |k| define_method(k) { @t.send(k) } }
|
81
81
|
|
82
|
-
def inc(i)
|
83
|
-
@t = @t + i
|
84
|
-
self
|
85
|
-
end
|
82
|
+
def inc(i); @t = @t + i; self; end
|
86
83
|
def dec(i); inc(-i); end
|
87
84
|
|
88
85
|
def inc_month
|
@@ -95,6 +92,7 @@ module Fugit
|
|
95
92
|
|
96
93
|
def inc_day
|
97
94
|
inc((24 - @t.hour) * 3600 - @t.min * 60 - @t.sec)
|
95
|
+
inc( - @t.hour * 3600) if @t.hour != 0 # compensate for entering DST
|
98
96
|
end
|
99
97
|
def inc_hour
|
100
98
|
inc((60 - @t.min) * 60 - @t.sec)
|
@@ -112,7 +110,7 @@ module Fugit
|
|
112
110
|
end
|
113
111
|
|
114
112
|
def dec_month
|
115
|
-
dec((@t.day - 1) *
|
113
|
+
dec((@t.day - 1) * DAY_S + @t.hour * 3600 + @t.min * 60 + @t.sec + 1)
|
116
114
|
end
|
117
115
|
|
118
116
|
def dec_day
|
@@ -332,7 +330,7 @@ module Fugit
|
|
332
330
|
[ :seconds, 1, 60 ],
|
333
331
|
[ :minutes, 60, 60 ],
|
334
332
|
[ :hours, 3600, 24 ],
|
335
|
-
[ :days,
|
333
|
+
[ :days, DAY_S, 365 ] ].freeze
|
336
334
|
|
337
335
|
def rough_frequency
|
338
336
|
|
@@ -374,7 +372,7 @@ module Fugit
|
|
374
372
|
|
375
373
|
@delta_min = deltas.min; @delta_max = deltas.max
|
376
374
|
@occurrences = deltas.size
|
377
|
-
@span_years = span /
|
375
|
+
@span_years = span / YEAR_S
|
378
376
|
@yearly_occurrences = @occurrences.to_f / @span_years
|
379
377
|
end
|
380
378
|
|
data/lib/fugit/duration.rb
CHANGED
@@ -61,10 +61,10 @@ module Fugit
|
|
61
61
|
end
|
62
62
|
|
63
63
|
KEYS = {
|
64
|
-
yea: { a: 'Y', r: 'y', i: 'Y', s:
|
65
|
-
mon: { a: 'M', r: 'M', i: 'M', s: 30 *
|
66
|
-
wee: { a: 'W', r: 'w', i: 'W', s: 7 *
|
67
|
-
day: { a: 'D', r: 'd', i: 'D', s:
|
64
|
+
yea: { a: 'Y', r: 'y', i: 'Y', s: YEAR_S, x: 0, l: 'year' },
|
65
|
+
mon: { a: 'M', r: 'M', i: 'M', s: 30 * DAY_S, x: 1, l: 'month' },
|
66
|
+
wee: { a: 'W', r: 'w', i: 'W', s: 7 * DAY_S, I: true, l: 'week' },
|
67
|
+
day: { a: 'D', r: 'd', i: 'D', s: DAY_S, I: true, l: 'day' },
|
68
68
|
hou: { a: 'h', r: 'h', i: 'H', s: 3600, I: true, l: 'hour' },
|
69
69
|
min: { a: 'm', r: 'm', i: 'M', s: 60, I: true, l: 'minute' },
|
70
70
|
sec: { a: 's', r: 's', i: 'S', s: 1, I: true, l: 'second' } }.freeze
|
data/lib/fugit/misc.rb
CHANGED
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
|
+
version: 1.4.3
|
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-
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: raabro
|