ice_cube 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,11 +51,7 @@ module IceCube
51
51
  time = date.to_time
52
52
  occurrences_between(time.beginning_of_day, time.end_of_day).any?
53
53
  end
54
-
55
- def occurrences_between(begin_time, end_time)
56
- find_occurrences { |head| head.between(begin_time, end_time) }
57
- end
58
-
54
+
59
55
  # Return all possible occurrences
60
56
  # In order to make this call, all rules in the schedule must have
61
57
  # either an until date or an occurrence count
@@ -104,7 +100,20 @@ module IceCube
104
100
  end
105
101
 
106
102
  attr_reader :rdates, :exdates
107
-
103
+
104
+ def occurrences_between(begin_time, end_time)
105
+ exclude_dates, include_dates = Set.new(@exdates), SortedSet.new(@rdates)
106
+ @rrule_occurrence_heads.each do |rrule_occurrence_head|
107
+ include_dates.merge(rrule_occurrence_head.between(begin_time, end_time))
108
+ end
109
+ @exrule_occurrence_heads.each do |exrule_occurrence_head|
110
+ exclude_dates.merge(exrule_occurrence_head.between(begin_time, end_time))
111
+ end
112
+ # reject all of the ones outside of the range
113
+ include_dates.reject! { |date| exclude_dates.include?(date) || date < begin_time || date > end_time }
114
+ include_dates.to_a
115
+ end
116
+
108
117
  private
109
118
 
110
119
  # Find all occurrences (following rules and exceptions) from the schedule's start date to end_date.
@@ -1,5 +1,5 @@
1
1
  module IceCube
2
2
 
3
- VERSION = "0.2.12"
3
+ VERSION = "0.2.13"
4
4
 
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 12
9
- version: 0.2.12
8
+ - 13
9
+ version: 0.2.13
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Crepezzi
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-20 00:00:00 -04:00
17
+ date: 2010-04-21 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency