chrono 0.2.0 → 0.3.0

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: e6fd43e8b0de253b8ac79fdc3185f2358cdc1791
4
- data.tar.gz: b67b7851d8a25655d694e344f898de04056428fe
3
+ metadata.gz: 82628fe0ca33aeac8bd5b8f6d72d570a250e5636
4
+ data.tar.gz: 093720914965710dccca4dca1054616bc676e783
5
5
  SHA512:
6
- metadata.gz: b727c4e40b24389e70e6ec01830b77b93368d74231801b4d9e6bf3b8499577b340639e69c026013e947c89c52fa025fab1c6da010d5ef95550d1a859df3356e3
7
- data.tar.gz: 5cbdd9900cff827c3d017fbdc5d2358253aa26bcc6c74c99f75bb9942e8f58ee9a6f4769859d59d71e0f7e3d9a28e3dcb22e88c62baa89a393309ca5f42d5680
6
+ metadata.gz: 2bdc77b1029f70e80ccde05ac6c5a3f4fe84d8e39d34c1484cf1b56a84580b0234e0e01b9b1604937d705c4241940f953565f5ff436a193cfb26f930b7339751
7
+ data.tar.gz: ff6f91a205265f49e78e208ada8f87f1c61d881d52c0bd9b6786eab1732944d8f72ce3fe1825327eacfa10f62507ca36a2cb92c11fbe709b6867bd1c41d95830
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.0
2
+ - Fix bug on day and wday specs
3
+
1
4
  ## 0.2.0
2
5
  - Add more strict validations
3
6
  - Support some alias field names
@@ -27,8 +27,6 @@ module Chrono
27
27
  carry_month
28
28
  when !scheduled_in_this_day?
29
29
  carry_day
30
- when !scheduled_in_this_wday?
31
- carry_day
32
30
  when !scheduled_in_this_hour?
33
31
  carry_hour
34
32
  when !scheduled_in_this_minute?
@@ -54,11 +52,19 @@ module Chrono
54
52
  end
55
53
 
56
54
  def scheduled_in_this_day?
57
- schedule.days.include?(time.day)
58
- end
59
-
60
- def scheduled_in_this_wday?
61
- schedule.wdays.include?(time.wday)
55
+ if schedule.days?
56
+ if schedule.wdays?
57
+ schedule.days.include?(time.day) || schedule.wdays.include?(time.wday)
58
+ else
59
+ schedule.days.include?(time.day)
60
+ end
61
+ else
62
+ if schedule.wdays?
63
+ schedule.wdays.include?(time.wday)
64
+ else
65
+ true
66
+ end
67
+ end
62
68
  end
63
69
 
64
70
  def scheduled_in_this_hour?
@@ -38,6 +38,14 @@ module Chrono
38
38
  Fields::Wday.new(fields[4]).to_a
39
39
  end
40
40
 
41
+ def days?
42
+ fields[2] != '*'
43
+ end
44
+
45
+ def wdays?
46
+ fields[4] != '*'
47
+ end
48
+
41
49
  private
42
50
 
43
51
  def fields
@@ -1,3 +1,3 @@
1
1
  module Chrono
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -22,6 +22,8 @@ describe Chrono::Iterator do
22
22
  "2000-01-04 00:00:00", "2000-01-04 00:01:00", "* * * * 2,3",
23
23
  "2000-01-01 00:01:00", "2000-01-01 00:04:00", "1-20/3 * * * *",
24
24
  "2000-01-01 00:20:00", "2000-01-01 01:01:00", "1-20/3 * * * *",
25
+ "2000-01-01 00:00:00", "2000-01-03 00:00:00", "0 0 1,15 * 1",
26
+ "2000-01-01 00:00:00", "2000-01-05 00:00:00", "0 0 5,15,25 * 5",
25
27
  ].each_slice(3) do |from, to, source|
26
28
  it "ticks #{from} to #{to} by #{source}" do
27
29
  now = Time.parse(from)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chrono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport