icalendar 2.0.0.beta.1 → 2.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/lib/icalendar/alarm.rb +5 -1
- data/lib/icalendar/parser.rb +43 -25
- data/lib/icalendar/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a5e107e53784e1a46b2eea851f53da90b4c7a5d
|
4
|
+
data.tar.gz: fc7ab4fdf29eee625e3b34f0c2989611973cb12a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8370c7815a1b841a87559805efe26cfe42762bfd6447a44206856fa30b347c6aedab88f6ff1690e44d3512d76506b7d5ca3c2438f9cc0bd53c360a6f84c426bc
|
7
|
+
data.tar.gz: 38d884b87d744f5224221577d3b0e525810823900c064a1c4c42097235db0fc3a3a16c5cc58e13728846047231753e5a4804bb41a6695874a3261157717d4e6a
|
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 2.0.0.beta.2 2014-04-11
|
2
|
+
* Add uid & acknowledged fields from valarm extensions
|
3
|
+
* Swallow NoMethodError on non-strict parsers
|
4
|
+
* Expose a parse_property method on Icalendar::Parser
|
5
|
+
|
1
6
|
=== 2.0.0.beta.1 2014-03-30
|
2
7
|
* Rewrite for easier development going forward.
|
3
8
|
|
data/lib/icalendar/alarm.rb
CHANGED
@@ -16,6 +16,10 @@ module Icalendar
|
|
16
16
|
|
17
17
|
optional_property :attach, Icalendar::Values::Uri
|
18
18
|
|
19
|
+
# not part of base spec - need better abstraction for extensions
|
20
|
+
optional_single_property :uid
|
21
|
+
optional_single_property :acknowledged, Icalendar::Values::DateTime
|
22
|
+
|
19
23
|
def initialize
|
20
24
|
super 'alarm'
|
21
25
|
end
|
@@ -32,4 +36,4 @@ module Icalendar
|
|
32
36
|
super
|
33
37
|
end
|
34
38
|
end
|
35
|
-
end
|
39
|
+
end
|
data/lib/icalendar/parser.rb
CHANGED
@@ -12,12 +12,13 @@ module Icalendar
|
|
12
12
|
else
|
13
13
|
raise ArgumentError, 'Icalendar::Parser.new must be called with a String or IO object'
|
14
14
|
end
|
15
|
+
read_in_data
|
15
16
|
@strict = strict
|
16
17
|
end
|
17
18
|
|
18
19
|
def parse
|
19
20
|
source.rewind
|
20
|
-
|
21
|
+
read_in_data
|
21
22
|
calendars = []
|
22
23
|
while (fields = next_fields)
|
23
24
|
if fields[:name] == 'begin' && fields[:value].downcase == 'vcalendar'
|
@@ -27,6 +28,41 @@ module Icalendar
|
|
27
28
|
calendars
|
28
29
|
end
|
29
30
|
|
31
|
+
def parse_property(component, fields = nil)
|
32
|
+
fields = next_fields if fields.nil?
|
33
|
+
klass = component.class.default_property_types[fields[:name]]
|
34
|
+
if !fields[:params]['value'].nil?
|
35
|
+
klass_name = fields[:params].delete('value').first
|
36
|
+
unless klass_name.upcase == klass.value_type
|
37
|
+
klass_name = klass_name.downcase.gsub(/(?:\A|-)(.)/) { |m| m[-1].upcase }
|
38
|
+
klass = Icalendar::Values.const_get klass_name if Icalendar::Values.const_defined?(klass_name)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if klass.value_type != 'RECUR' && fields[:value] =~ /(?<!\\)([,;])/
|
42
|
+
delimiter = $1
|
43
|
+
prop_value = Icalendar::Values::Array.new fields[:value].split(/(?<!\\)[;,]/),
|
44
|
+
klass,
|
45
|
+
fields[:params],
|
46
|
+
delimiter: delimiter
|
47
|
+
else
|
48
|
+
prop_value = klass.new fields[:value], fields[:params]
|
49
|
+
end
|
50
|
+
prop_name = %w(class method).include?(fields[:name]) ? "ip_#{fields[:name]}" : fields[:name]
|
51
|
+
begin
|
52
|
+
if component.class.multiple_properties.include? prop_name
|
53
|
+
component.send "append_#{prop_name}", prop_value
|
54
|
+
else
|
55
|
+
component.send "#{prop_name}=", prop_value
|
56
|
+
end
|
57
|
+
rescue NoMethodError => nme
|
58
|
+
raise nme if strict?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def strict?
|
63
|
+
!!@strict
|
64
|
+
end
|
65
|
+
|
30
66
|
private
|
31
67
|
|
32
68
|
def parse_component(component)
|
@@ -44,38 +80,20 @@ module Icalendar
|
|
44
80
|
end
|
45
81
|
else
|
46
82
|
# new property
|
47
|
-
|
48
|
-
if !fields[:params]['value'].nil?
|
49
|
-
klass_name = fields[:params].delete('value').first
|
50
|
-
unless klass_name.upcase == klass.value_type
|
51
|
-
klass_name = klass_name.downcase.gsub(/(?:\A|-)(.)/) { |m| m[-1].upcase }
|
52
|
-
klass = Icalendar::Values.const_get klass_name if Icalendar::Values.const_defined?(klass_name)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
if klass.value_type != 'RECUR' && fields[:value] =~ /(?<!\\)([,;])/
|
56
|
-
delimiter = $1
|
57
|
-
prop_value = Icalendar::Values::Array.new fields[:value].split(/(?<!\\)[;,]/),
|
58
|
-
klass,
|
59
|
-
fields[:params],
|
60
|
-
delimiter: delimiter
|
61
|
-
else
|
62
|
-
prop_value = klass.new fields[:value], fields[:params]
|
63
|
-
end
|
64
|
-
prop_name = %w(class method).include?(fields[:name]) ? "ip_#{fields[:name]}" : fields[:name]
|
65
|
-
if component.class.multiple_properties.include? prop_name
|
66
|
-
component.send "append_#{prop_name}", prop_value
|
67
|
-
else
|
68
|
-
component.send "#{prop_name}=", prop_value
|
69
|
-
end
|
83
|
+
parse_property component, fields
|
70
84
|
end
|
71
85
|
end
|
72
86
|
component
|
73
87
|
end
|
74
88
|
|
89
|
+
def read_in_data
|
90
|
+
@data = source.gets and @data.chomp!
|
91
|
+
end
|
92
|
+
|
75
93
|
def next_fields
|
76
94
|
line = @data or return nil
|
77
95
|
loop do
|
78
|
-
|
96
|
+
read_in_data
|
79
97
|
if @data =~ /\A[ \t].+\z/
|
80
98
|
line << @data[1, @data.size]
|
81
99
|
elsif @data !~ /\A\s*\z/
|
data/lib/icalendar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icalendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.beta.
|
4
|
+
version: 2.0.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|