ice_cube 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -218,7 +218,7 @@ module IceCube
218
218
 
219
219
  # Convert the schedule to yaml
220
220
  def to_yaml(*args)
221
- defined?(Psych) ? Psych::dump(to_hash) : YAML::dump(to_hash, *args)
221
+ defined?(Psych) ? Psych::dump(to_hash, *args) : YAML::dump(to_hash, *args)
222
222
  end
223
223
 
224
224
  # Load the schedule from yaml
@@ -37,7 +37,10 @@ module IceCube
37
37
  end
38
38
 
39
39
  def validate(time, schedule)
40
- hours = (time.to_i - schedule.start_time.to_i) / IceCube::ONE_HOUR
40
+ start_time = schedule.start_time
41
+ sec = (time.to_i - time.to_i % ONE_HOUR) -
42
+ (start_time.to_i - start_time.to_i % ONE_HOUR)
43
+ hours = sec / ONE_HOUR
41
44
  unless hours % interval == 0
42
45
  interval - (hours % interval)
43
46
  end
@@ -37,7 +37,10 @@ module IceCube
37
37
  end
38
38
 
39
39
  def validate(time, schedule)
40
- minutes = (time.to_i - schedule.start_time.to_i) / IceCube::ONE_MINUTE
40
+ start_time = schedule.start_time
41
+ sec = (time.to_i - time.to_i % ONE_MINUTE) -
42
+ (start_time.to_i - start_time.to_i % ONE_MINUTE)
43
+ minutes = sec / ONE_MINUTE
41
44
  unless minutes % interval == 0
42
45
  interval - (minutes % interval)
43
46
  end
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = '0.7.2'
3
+ VERSION = '0.7.3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ice_cube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70287244744060 !ruby/object:Gem::Requirement
16
+ requirement: &70170849596680 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70287244744060
24
+ version_requirements: *70170849596680
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: active_support
27
- requirement: &70287244742720 !ruby/object:Gem::Requirement
27
+ requirement: &70170849596140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70287244742720
35
+ version_requirements: *70170849596140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: tzinfo
38
- requirement: &70287244741720 !ruby/object:Gem::Requirement
38
+ requirement: &70170849595700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70287244741720
46
+ version_requirements: *70170849595700
47
47
  description: ice_cube is a recurring date library for Ruby. It allows for quick,
48
48
  programatic expansion of recurring date rules.
49
49
  email: john@crepezzi.com