fugit 1.3.1 → 1.3.2

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
  SHA1:
3
- metadata.gz: b6c020a2dc2dea8ee73eae196c502e1353839f84
4
- data.tar.gz: d4d43e932e0e4de4d07d402db975bf2a642df687
3
+ metadata.gz: a1f0b03b24c2f3467b85203b569060a3bd1e43e5
4
+ data.tar.gz: d7b5598b726f4dfc49e9ab73bc970ce4e02e6944
5
5
  SHA512:
6
- metadata.gz: 7c7f5319195ca991c848826b336023f429fc21ad033b26d67b7011872b91d1e9f8fb639b2618eda9dd1e199d7e473599e356924f302bb5cbaba20817aa6ab050
7
- data.tar.gz: 4358df79feebbdb50509b78735fad8210d5c3d001d6a0b3d5a85aa375be08605816ea87510abc8188b5e42d091cd4d47af91a18061d956dc10a115fd9397c7eb
6
+ metadata.gz: 3e6b92e0d2805d0bc4cc109342d7e4692b460e9d805ffff44c17bd645bddf88ea78f51b9d092fce6cbfb7ff31f62ca53dd88f009cc25c1759210e26c267d065c
7
+ data.tar.gz: 52b960a0e3ceb3e0fdaec890e4b8731bc17a25bce5d161cfdfbb1b7a5d7ddc6126284bffa7262239c557e150b7b58fcccb9fff5188c1306ec2ba18d1ca7f00a3
@@ -2,6 +2,11 @@
2
2
  # CHANGELOG.md
3
3
 
4
4
 
5
+ ## fugit 1.3.2 released 2019-08-14
6
+
7
+ * Allow for "* 0-24 * * *", gh-30
8
+
9
+
5
10
  ## fugit 1.3.1 released 2019-07-27
6
11
 
7
12
  * Fix nat parsing for 'every day at 18:00 and 18:15', gh-29
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')
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Fugit
3
3
 
4
- VERSION = '1.3.1'
4
+ VERSION = '1.3.2'
5
5
  end
6
6
 
7
7
  require 'time'
@@ -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
- cur = min if cur > max
506
- #p cur
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.select { |e, i| i % sla == 0 }.collect(&:first)
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.1
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-07-27 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: raabro