ice_cube 0.6.8 → 0.6.9
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/schedule.rb +17 -1
- data/lib/ice_cube/version.rb +1 -1
- metadata +28 -35
data/lib/ice_cube/schedule.rb
CHANGED
@@ -12,7 +12,7 @@ module IceCube
|
|
12
12
|
@exrule_occurrence_heads = []
|
13
13
|
@rdates = []
|
14
14
|
@exdates = []
|
15
|
-
@start_date = start_date
|
15
|
+
@start_date = start_date || Time.now
|
16
16
|
raise ArgumentError.new('Duration cannot be negative') if options[:duration] && options[:duration] < 0
|
17
17
|
@duration = options[:duration]
|
18
18
|
raise ArgumentError.new('Start time must be before end time') if options[:end_time] && options[:end_time] < @start_date
|
@@ -115,6 +115,15 @@ module IceCube
|
|
115
115
|
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?
|
116
116
|
end
|
117
117
|
|
118
|
+
def occurs_between?(begin_time, end_time)
|
119
|
+
if defined?(ActiveSupport::TimeWithZone) && @start_date.is_a?(ActiveSupport::TimeWithZone)
|
120
|
+
return active_support_occurs_between?(begin_time, end_time)
|
121
|
+
end
|
122
|
+
# fall back to our own way of doing things
|
123
|
+
time_format = @start_date.utc? ? :utc : :local
|
124
|
+
self.occurrences_between(Time.send(time_format, begin_time.year, begin_time.month, begin_time.day, 0, 0, 0), Time.send(time_format, end_time.year, end_time.month, end_time.day, 23, 59, 59)).any?
|
125
|
+
end
|
126
|
+
|
118
127
|
# Return all possible occurrences
|
119
128
|
# In order to make this call, all rules in the schedule must have
|
120
129
|
# either an until date or an occurrence count
|
@@ -214,6 +223,13 @@ module IceCube
|
|
214
223
|
occurrences_between(time.beginning_of_day, time.end_of_day).any?
|
215
224
|
end
|
216
225
|
|
226
|
+
def active_support_occurs_between(start_time, end_time)
|
227
|
+
time_start = Time.zone.parse(start_time.to_s) # date.to_time.in_time_zone(@start_date.time_zone)
|
228
|
+
time_end = Time.zone.parse(end_time.to_s) # date.to_time.in_time_zone(@end_date.time_zone)
|
229
|
+
|
230
|
+
occurrences_between(time_start.beginning_of_day, time_end.end_of_day).any?
|
231
|
+
end
|
232
|
+
|
217
233
|
# tell if, from a list of rule_occurrence heads, a certain time is occurring
|
218
234
|
def any_occurring_at?(what, time)
|
219
235
|
return false if @start_time && time < @start_time
|
data/lib/ice_cube/version.rb
CHANGED
metadata
CHANGED
@@ -1,38 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ice_cube
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.9
|
4
5
|
prerelease:
|
5
|
-
version: 0.6.8
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- John Crepezzi
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
date: 2011-05-10 00:00:00 -04:00
|
12
|
+
date: 2011-07-31 00:00:00.000000000 -04:00
|
14
13
|
default_executable:
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
17
16
|
name: rspec
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70106362064800 !ruby/object:Gem::Requirement
|
20
18
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
25
23
|
type: :development
|
26
|
-
|
27
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70106362064800
|
26
|
+
description: ice_cube is a recurring date library for Ruby. It allows for quick,
|
27
|
+
programatic expansion of recurring date rules.
|
28
28
|
email: john@crepezzi.com
|
29
29
|
executables: []
|
30
|
-
|
31
30
|
extensions: []
|
32
|
-
|
33
31
|
extra_rdoc_files: []
|
34
|
-
|
35
|
-
files:
|
32
|
+
files:
|
36
33
|
- lib/ice_cube/rule.rb
|
37
34
|
- lib/ice_cube/rule_occurrence.rb
|
38
35
|
- lib/ice_cube/rules/daily_rule.rb
|
@@ -59,30 +56,26 @@ files:
|
|
59
56
|
has_rdoc: true
|
60
57
|
homepage: http://seejohnrun.github.com/ice_cube/
|
61
58
|
licenses: []
|
62
|
-
|
63
59
|
post_install_message:
|
64
60
|
rdoc_options: []
|
65
|
-
|
66
|
-
require_paths:
|
61
|
+
require_paths:
|
67
62
|
- lib
|
68
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
64
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version:
|
74
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
70
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version:
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
80
75
|
requirements: []
|
81
|
-
|
82
76
|
rubyforge_project: ice-cube
|
83
77
|
rubygems_version: 1.6.2
|
84
78
|
signing_key:
|
85
79
|
specification_version: 3
|
86
80
|
summary: Ruby Date Recurrence Library
|
87
81
|
test_files: []
|
88
|
-
|