ice_cube 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/ice_cube/schedule.rb
CHANGED
@@ -105,10 +105,10 @@ module IceCube
|
|
105
105
|
end
|
106
106
|
|
107
107
|
# Determine whether a given date appears in the times returned by the schedule
|
108
|
-
# Required activeSupport
|
109
108
|
def occurs_on?(date)
|
110
|
-
|
111
|
-
|
109
|
+
return active_support_occurs_on?(date) if date.respond_to?(:to_time)
|
110
|
+
time_format = @start_date.utc? ? :utc : :local
|
111
|
+
self.occurrences_between(Time.send(time_format, date.year, date.month, date.day, 0, 0, 0), Time.send(time_format, date.year, date.month, date.day, 23, 59, 59)).any?
|
112
112
|
end
|
113
113
|
|
114
114
|
# Return all possible occurrences
|
@@ -184,7 +184,12 @@ module IceCube
|
|
184
184
|
|
185
185
|
|
186
186
|
private
|
187
|
-
|
187
|
+
|
188
|
+
def active_support_occurs_on?(date)
|
189
|
+
time = date.to_time
|
190
|
+
occurrences_between(time.beginning_of_day, time.end_of_day).any?
|
191
|
+
end
|
192
|
+
|
188
193
|
# tell if, from a list of rule_occurrence heads, a certain time is occurring
|
189
194
|
def any_occurring_at?(what, time)
|
190
195
|
return false if @start_time && time < @start_time
|
@@ -35,7 +35,7 @@ module IceCube
|
|
35
35
|
representation << 'on the '
|
36
36
|
representation << @days_of_week.map do |day, occ|
|
37
37
|
self.class.nice_numbers(occ) << ' ' << Date::DAYNAMES[day] << (occ.size != 1 ? 's' : '') unless @days_of_week.empty?
|
38
|
-
end.join('
|
38
|
+
end.join(' when it is the ')
|
39
39
|
representation
|
40
40
|
end
|
41
41
|
|
data/lib/ice_cube/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ice_cube
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Crepezzi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-28 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|