jruby-rfc2445 0.1.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rrule.rb +11 -2
- data/spec/rfc2445_spec.rb +3 -3
- metadata +2 -2
data/lib/rrule.rb
CHANGED
@@ -3,6 +3,8 @@ require File.dirname(__FILE__) + '/rfc2445.jar'
|
|
3
3
|
|
4
4
|
class RRule
|
5
5
|
include_class('com.google.ical.values.RRule'){|package,name| "J#{name}" }
|
6
|
+
include_class('com.google.ical.values.DateTimeValue')
|
7
|
+
include_class('com.google.ical.values.DateValue')
|
6
8
|
|
7
9
|
RRULE = 'RRULE'
|
8
10
|
EXRULE = 'EXRULE'
|
@@ -221,10 +223,17 @@ class RRule
|
|
221
223
|
self
|
222
224
|
end
|
223
225
|
|
224
|
-
# Gets the end date
|
226
|
+
# Gets the end date, assume it is UTC for now
|
225
227
|
def until
|
226
228
|
d = @rrule.getUntil
|
227
|
-
|
229
|
+
case d
|
230
|
+
when DateTimeValue
|
231
|
+
JTime.from_date_time_value(d)
|
232
|
+
when DateValue
|
233
|
+
JTime.from_date_value(d)
|
234
|
+
else
|
235
|
+
nil
|
236
|
+
end
|
228
237
|
end
|
229
238
|
|
230
239
|
# Sets the end date
|
data/spec/rfc2445_spec.rb
CHANGED
@@ -286,7 +286,7 @@ describe RRule do
|
|
286
286
|
end
|
287
287
|
|
288
288
|
it "should set and get the until date" do
|
289
|
-
now = JTime.new
|
289
|
+
now = JTime.new.utc
|
290
290
|
@rrule.until = now
|
291
291
|
@rrule.until.year.should == now.year
|
292
292
|
@rrule.until.month.should == now.month
|
@@ -419,9 +419,9 @@ describe ICalParseUtil do
|
|
419
419
|
jtime1.should be_instance_of(JTime)
|
420
420
|
jtime1.hour.should == 0
|
421
421
|
|
422
|
-
jtime2 = ICalParseUtil.parse_datetime('DTEND;TZID=America/Los_Angeles:
|
422
|
+
jtime2 = ICalParseUtil.parse_datetime('DTEND;TZID=America/Los_Angeles:20090320T180000')
|
423
423
|
jtime2.should be_instance_of(JTime)
|
424
|
-
jtime2.hour.should ==
|
424
|
+
jtime2.hour.should == 1
|
425
425
|
|
426
426
|
jtime3 = ICalParseUtil.parse_datetime(nil)
|
427
427
|
jtime3.should be_nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-rfc2445
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerry Luk
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|