ohac-ricalv 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ricalv.rb +24 -2
- metadata +1 -1
data/lib/ricalv.rb
CHANGED
@@ -3,6 +3,27 @@ require 'icalendar'
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'digest'
|
5
5
|
|
6
|
+
# FIXME monkey patch for icalendar 1.1.0
|
7
|
+
module Icalendar
|
8
|
+
|
9
|
+
class RRule
|
10
|
+
|
11
|
+
def to_ical
|
12
|
+
result = ["FREQ=#{@frequency}"]
|
13
|
+
result << ";UNTIL=#{@until.to_ical}" if @until
|
14
|
+
result << ";COUNT=#{@count}" if @count
|
15
|
+
result << ";INTERVAL=#{@interval}" if @interval
|
16
|
+
@by_list.each do |key, value|
|
17
|
+
result << ";#{key.to_s.upcase}=#{value[0]}" if value
|
18
|
+
end
|
19
|
+
result << ";WKST=#{@wkst}" if @wkst
|
20
|
+
result.join
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
6
27
|
WEEKTABLE = { 'SU' => 7, 'MO' => 1, 'TU' => 2,
|
7
28
|
'WE' => 3, 'TH' => 4, 'FR' => 5, 'SA' => 6 }
|
8
29
|
KEYS = [ 'FREQ', 'BYDAY', 'BYMONTH', 'WKST', 'UNTIL', 'INTERVAL' ]
|
@@ -50,7 +71,8 @@ items = calss.map { |cals|
|
|
50
71
|
rrule = event.properties["rrule"]
|
51
72
|
if rrule
|
52
73
|
rulehash = {}
|
53
|
-
rule = rrule[0].
|
74
|
+
rule = rrule[0].to_ical # TODO for icalendar 1.1.0
|
75
|
+
rule = rule.split(";")
|
54
76
|
rule.each do |item|
|
55
77
|
a, b = item.split("=")
|
56
78
|
rulehash[a] = b
|
@@ -84,7 +106,7 @@ items = calss.map { |cals|
|
|
84
106
|
end
|
85
107
|
end
|
86
108
|
if yearly
|
87
|
-
d = d.next_year
|
109
|
+
d = d.next_year # TODO for ruby1.9
|
88
110
|
d = Date.new(d.year, mon, 1) if mon
|
89
111
|
while d <= ud
|
90
112
|
if day
|