texel-recurrence-rule-parser 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +2 -2
- data/lib/rrule_parser.rb +10 -0
- metadata +1 -1
data/README.txt
CHANGED
@@ -37,8 +37,8 @@ on formatting of recurrence rules, visit http://www.kanzaki.com/docs/ical/rrule.
|
|
37
37
|
|
38
38
|
== REQUIREMENTS:
|
39
39
|
|
40
|
-
requires Runt.
|
41
|
-
requires Icalendar and RSpec if you wish to run the specs.
|
40
|
+
requires Runt (http://runt.rubyforge.org).
|
41
|
+
requires Icalendar (http://icalendar.rubyforge.org) and RSpec (http://www.rspec.info) if you wish to run the specs.
|
42
42
|
|
43
43
|
== INSTALL:
|
44
44
|
|
data/lib/rrule_parser.rb
CHANGED
@@ -72,6 +72,7 @@ class RruleParser
|
|
72
72
|
protected
|
73
73
|
|
74
74
|
def parse_rules(event)
|
75
|
+
self.rules = {}
|
75
76
|
rrules = event.recurrence_rules
|
76
77
|
rrules.each do |rule|
|
77
78
|
pairs = rule.split(";")
|
@@ -87,6 +88,15 @@ class RruleParser
|
|
87
88
|
rules[key] = rule.split(',')
|
88
89
|
end
|
89
90
|
end
|
91
|
+
|
92
|
+
# Override rules to_s
|
93
|
+
self.rules.instance_eval do
|
94
|
+
def to_s
|
95
|
+
self.map do |key, value|
|
96
|
+
"#{key.to_s.upcase}=#{value.map.join(',')}"
|
97
|
+
end.join(";")
|
98
|
+
end
|
99
|
+
end
|
90
100
|
end
|
91
101
|
|
92
102
|
def parse_start
|