fugit 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/CREDITS.md +1 -0
- data/README.md +4 -2
- data/lib/fugit.rb +1 -1
- data/lib/fugit/cron.rb +10 -5
- 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: a1f0b03b24c2f3467b85203b569060a3bd1e43e5
|
|
4
|
+
data.tar.gz: d7b5598b726f4dfc49e9ab73bc970ce4e02e6944
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e6b92e0d2805d0bc4cc109342d7e4692b460e9d805ffff44c17bd645bddf88ea78f51b9d092fce6cbfb7ff31f62ca53dd88f009cc25c1759210e26c267d065c
|
|
7
|
+
data.tar.gz: 52b960a0e3ceb3e0fdaec890e4b8731bc17a25bce5d161cfdfbb1b7a5d7ddc6126284bffa7262239c557e150b7b58fcccb9fff5188c1306ec2ba18d1ca7f00a3
|
data/CHANGELOG.md
CHANGED
data/CREDITS.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# fugit credits
|
|
3
3
|
|
|
4
|
+
* Jessica Stokes https://github.com/ticky 0-24 issue with cron, gh-30
|
|
4
5
|
* Shai Coleman https://github.com/shaicoleman parse_nat enhancements, gh-24, gh-25, and gh-28
|
|
5
6
|
* Jan Stevens https://github.com/JanStevens Fugit.parse('every 15 minutes') gh-22
|
|
6
7
|
* Fabio Pitino https://github.com/hspazio nil on February 30 gh-21
|
data/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Fugit.parse('nada')
|
|
|
63
63
|
## `Fugit.do_parse(s)`
|
|
64
64
|
|
|
65
65
|
`Fugit.do_parse(s)` is equivalent to `Fugit.parse(s)`, but instead of returning nil, it raises an error if the given string contains no time information.
|
|
66
|
-
```
|
|
66
|
+
```ruby
|
|
67
67
|
Fugit.do_parse('nada')
|
|
68
68
|
# ==> /home/jmettraux/w/fugit/lib/fugit/parse.rb:32
|
|
69
69
|
# :in `do_parse': found no time information in "nada" (ArgumentError)
|
|
@@ -184,10 +184,12 @@ p d.to_long_s # => "2 years, 2 months, 1 day, and 5 hours"
|
|
|
184
184
|
d += 3600
|
|
185
185
|
|
|
186
186
|
p d.to_plain_s # => "2Y2M1D5h3600s"
|
|
187
|
+
|
|
188
|
+
p Fugit::Duration.parse('1y2M1d4h').to_sec # => 36820800
|
|
187
189
|
```
|
|
188
190
|
|
|
189
191
|
The `to_*_s` methods are also available as class methods:
|
|
190
|
-
```
|
|
192
|
+
```ruby
|
|
191
193
|
p Fugit::Duration.to_plain_s('1y2M1d4h')
|
|
192
194
|
# => "1Y2M1D4h"
|
|
193
195
|
p Fugit::Duration.to_iso_s('1y2M1d4h')
|
data/lib/fugit.rb
CHANGED
data/lib/fugit/cron.rb
CHANGED
|
@@ -497,23 +497,28 @@ module Fugit
|
|
|
497
497
|
|
|
498
498
|
loop do
|
|
499
499
|
|
|
500
|
-
#p({ cur: cur })
|
|
501
500
|
a << cur
|
|
502
501
|
break if cur == edn
|
|
503
502
|
|
|
504
503
|
cur += 1
|
|
505
|
-
|
|
506
|
-
|
|
504
|
+
if cur > max
|
|
505
|
+
cur = min
|
|
506
|
+
edn = edn - max - 1 if edn > max
|
|
507
|
+
end
|
|
507
508
|
|
|
508
509
|
fail RuntimeError.new(
|
|
509
510
|
"too many loops for " +
|
|
510
511
|
{ min: omin, max: omax, sta: sta, edn: edn, sla: sla }.inspect +
|
|
511
512
|
" #range, breaking, " +
|
|
512
513
|
"please fill an issue at https://git.io/fjJC9"
|
|
513
|
-
) if a.length > omax
|
|
514
|
+
) if a.length > 2 * omax
|
|
515
|
+
# there is a #uniq afterwards, hence the 2* for 0-24 and friends
|
|
514
516
|
end
|
|
515
517
|
|
|
516
|
-
a.each_with_index
|
|
518
|
+
a.each_with_index
|
|
519
|
+
.select { |e, i| i % sla == 0 }
|
|
520
|
+
.collect(&:first)
|
|
521
|
+
.uniq
|
|
517
522
|
end
|
|
518
523
|
|
|
519
524
|
def compact(key)
|
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.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Mettraux
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: raabro
|