cron_format 0.2.0 → 0.2.1

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: c876978dc3f4b5ceacd3d314d1a8184c123a184c
4
- data.tar.gz: 00c674f845160a27ee3696ccda6c11c7557e3cdf
3
+ metadata.gz: 3c5c6f011a03923600318a6a64ea5b641cd0355d
4
+ data.tar.gz: 6e83610d7fc452f921a90009da3c75192669b36f
5
5
  SHA512:
6
- metadata.gz: 98586dbd16b8644edd4c24fbb5297c19e0bf9141bb768d4ffc7ff48af5a23829b710f0565db7b6511521a7b9f0ea627d88bdcb7df1bb62416687b5012c5ead9d
7
- data.tar.gz: d3187eaff6b8a6e01d3efc044eb005bba7d50c9cb09ae9ab9ca2991f278ce567f5f4927787e8561c163db17fd61aa5174f470fdc290a743fdc8cb0550b4ee2d0
6
+ metadata.gz: 63b4f3dd0d85709480e0ff391f7589ddc3484f470f7faf7439955aab4a444e12cb6b076d4a74d438635f9b07b7b03a91e69d161600112ab633ef17b12f930d5c
7
+ data.tar.gz: 03cbe6fa7d0327236bb37d774fcc6ddd008943f87127dd4716747e7f86ebd379d5520209587c8d294fe380fb002cbd4fca3343169276a6b70848280cb222b5e1
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/cron_format.rb CHANGED
@@ -23,8 +23,8 @@ class CronFormat
23
23
  end
24
24
 
25
25
  def next()
26
-
27
- nudge() unless @cron_string =~ %r{/}
26
+
27
+ nudge() #unless @cron_string =~ %r{/}
28
28
  parse()
29
29
  end
30
30
 
@@ -33,13 +33,24 @@ class CronFormat
33
33
  def nudge()
34
34
 
35
35
  a = @cron_string.split
36
- val = a.detect{|x| x != '*'}
36
+
37
+ val = if @cron_string =~ %r{/} then
38
+ a.reverse.detect{|x| x[/\//]}
39
+ else
40
+ a.detect{|x| x != '*'}
41
+ end
42
+
37
43
  index, n = 0, 1
38
44
 
39
45
  if val then
40
46
  index = a.index(val)
41
47
  r = val[/\/(\d+)$/,1]
42
- n = r.to_i if r
48
+
49
+ n = if r then
50
+ r.to_i * 7 if index == 4
51
+ else
52
+ val.to_i
53
+ end
43
54
  end
44
55
 
45
56
  month_proc = lambda {|t1,n|
@@ -61,7 +72,6 @@ class CronFormat
61
72
  ]
62
73
 
63
74
  r = units[index].call @to_time, n
64
-
65
75
  @to_time = r
66
76
 
67
77
  end
@@ -89,7 +99,7 @@ class CronFormat
89
99
  end
90
100
 
91
101
  @to_time += HOUR until @to_time.hour == hours.to_i if hours[/^\d+$/]
92
- end
102
+ end
93
103
 
94
104
  if wday[/^[0-6]$/] and @to_time.wday != wday.to_i then
95
105
  @to_time += DAY until @to_time.wday == wday.to_i
@@ -181,7 +191,7 @@ class CronFormat
181
191
  end
182
192
  end
183
193
 
184
- dates = inflate(raw_date)
194
+ dates = inflate(raw_date)
185
195
 
186
196
  a = dates.map do |date|
187
197
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cron_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  MmJuAQVfTk9wZd03YN619a64hLGIvud4ASW7UVAW0B4U0PcmbhHvne07e11jt7j5
32
32
  WwVcDIvT38Bo3hAt
33
33
  -----END CERTIFICATE-----
34
- date: 2015-01-15 00:00:00.000000000 Z
34
+ date: 2015-01-16 00:00:00.000000000 Z
35
35
  dependencies: []
36
36
  description:
37
37
  email: james@r0bertson.co.uk
metadata.gz.sig CHANGED
Binary file