ice_cube 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,6 +68,11 @@ module IceCube
68
68
  next_time(time, schedule, time) == time
69
69
  end
70
70
 
71
+ # Whether this rule requires a full run
72
+ def full_required?
73
+ !@count.nil?
74
+ end
75
+
71
76
  # Convenience methods for creating Rules
72
77
  class << self
73
78
 
@@ -276,17 +276,21 @@ module IceCube
276
276
  answers = []
277
277
  # ensure the bounds are proper
278
278
  if end_time
279
- closing_time = end_time unless closing_time && closing_time < @end_time
279
+ closing_time = end_time unless closing_time && closing_time < end_time
280
280
  end
281
281
  opening_time = start_time if opening_time < start_time
282
- # And off we go
283
- time = opening_time
282
+ # walk up to the opening time - and off we go
283
+ # If we have rules with counts, we need to walk from the beginning of time,
284
+ # otherwise opening_time
285
+ time = full_required? ? start_time : opening_time
284
286
  loop do
285
287
  res = next_time(time, closing_time)
286
288
  break unless res
287
289
  break if closing_time && res > closing_time
288
- block_given? ? block.call(res) : (answers << res)
289
- break if limit && answers.length == limit
290
+ if res >= opening_time
291
+ block_given? ? block.call(res) : (answers << res)
292
+ break if limit && answers.length == limit
293
+ end
290
294
  time = res + 1
291
295
  end
292
296
  # and return our answers
@@ -324,6 +328,12 @@ module IceCube
324
328
  min_time
325
329
  end
326
330
 
331
+ # Return a boolean indicating if any rule needs to be run from the start of time
332
+ def full_required?
333
+ @all_recurrence_rules.any?(&:full_required?) ||
334
+ @all_exception_rules.any?(&:full_required?)
335
+ end
336
+
327
337
  # Return a boolean indicating whether or not a specific time
328
338
  # is excluded from the schedule
329
339
  def exception_time?(time)
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = '0.7.4'
3
+ VERSION = '0.7.5'
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.4
4
+ version: 0.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-14 00:00:00.000000000 -05:00
13
- default_executable:
12
+ date: 2011-12-22 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &70109986640720 !ruby/object:Gem::Requirement
16
+ requirement: &70240051831480 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *70109986640720
24
+ version_requirements: *70240051831480
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: active_support
28
- requirement: &70109986640220 !ruby/object:Gem::Requirement
27
+ requirement: &70240051830160 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: 3.0.0
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: *70109986640220
35
+ version_requirements: *70240051830160
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: tzinfo
39
- requirement: &70109986639480 !ruby/object:Gem::Requirement
38
+ requirement: &70240051829120 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,7 @@ dependencies:
44
43
  version: '0'
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *70109986639480
46
+ version_requirements: *70240051829120
48
47
  description: ice_cube is a recurring date library for Ruby. It allows for quick,
49
48
  programatic expansion of recurring date rules.
50
49
  email: john@crepezzi.com
@@ -91,7 +90,6 @@ files:
91
90
  - lib/ice_cube/version.rb
92
91
  - lib/ice_cube.rb
93
92
  - spec/spec_helper.rb
94
- has_rdoc: true
95
93
  homepage: http://seejohnrun.github.com/ice_cube/
96
94
  licenses: []
97
95
  post_install_message:
@@ -112,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
110
  version: '0'
113
111
  requirements: []
114
112
  rubyforge_project: ice-cube
115
- rubygems_version: 1.6.2
113
+ rubygems_version: 1.8.10
116
114
  signing_key:
117
115
  specification_version: 3
118
116
  summary: Ruby Date Recurrence Library