ice_cube 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ice_cube/rule_occurrence.rb +3 -7
- data/lib/ice_cube/version.rb +1 -1
- metadata +3 -3
@@ -22,10 +22,6 @@ module IceCube
|
|
22
22
|
find_occurrences { |roc| roc > end_time }.select { |d| d >= begin_time }
|
23
23
|
end
|
24
24
|
|
25
|
-
def occurring_at?(time)
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
25
|
def upto(end_date)
|
30
26
|
find_occurrences { |roc| roc > end_date }
|
31
27
|
end
|
@@ -47,6 +43,7 @@ module IceCube
|
|
47
43
|
end
|
48
44
|
#walk through all of the successive dates, looking for the next occurrence (interval-valid), then return it.
|
49
45
|
begin
|
46
|
+
return nil if yield(date)
|
50
47
|
return nil if @end_time && date > @end_time
|
51
48
|
return nil if @rule.until_date && date > @rule.until_date # until check
|
52
49
|
return RuleOccurrence.new(@rule, @start_date, @end_time, date, @index + 1) if @rule.in_interval?(date, @start_date)
|
@@ -57,15 +54,14 @@ module IceCube
|
|
57
54
|
|
58
55
|
private
|
59
56
|
|
60
|
-
def find_occurrences
|
57
|
+
def find_occurrences(&block)
|
61
58
|
include_dates = []
|
62
59
|
roc = self
|
63
60
|
begin
|
64
61
|
break if roc.nil? #go until we run out of dates
|
65
62
|
next if roc.to_time.nil? #handle the case where start_date is not a valid occurrence
|
66
|
-
break if yield(roc) #recurrence condition
|
67
63
|
include_dates << roc.to_time
|
68
|
-
end while roc = roc.succ
|
64
|
+
end while roc = roc.succ(&block)
|
69
65
|
include_dates
|
70
66
|
end
|
71
67
|
|
data/lib/ice_cube/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 2
|
9
|
+
version: 0.4.2
|
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-06
|
17
|
+
date: 2010-07-06 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|