tilia-vobject 4.0.0.pre.alpha2 → 4.0.0.pre.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tilia/v_object/component/v_alarm.rb +6 -4
- data/lib/tilia/v_object/component/v_card.rb +1 -1
- data/lib/tilia/v_object/component.rb +19 -1
- data/lib/tilia/v_object/document.rb +6 -6
- data/lib/tilia/v_object/node.rb +14 -3
- data/lib/tilia/v_object/parser/parser.rb +2 -2
- data/lib/tilia/v_object/parser/xml.rb +2 -2
- data/lib/tilia/v_object/property.rb +17 -1
- data/lib/tilia/v_object/version.rb +1 -1
- data/test/v_object/document_test.rb +3 -3
- 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: 8900d4d2faaf438d17e6923a26592c4ee2f27774
|
4
|
+
data.tar.gz: b0be93b82f5ccc6c0e9f946e049779f9c7bb3e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2821bac8ff9cb8c5cc9deb317e1801818885d7535658c926bcda7150d8f45ad0aab2a16cb9ec834f4141bef7eb754e90cf3f24f3957b18b85d4a91c893613f95
|
7
|
+
data.tar.gz: befa8ae1001750277f5a3ae90d364d44e81865bc10f03afebff9d38a4758b3f06ffcda8559975e8666f025cf644ea4f0d9b6c7ab9722f94f558c0aa16cc06420
|
@@ -70,13 +70,15 @@ module Tilia
|
|
70
70
|
|
71
71
|
if key?('DURATION')
|
72
72
|
duration = DateTimeParser.parse_duration(self['DURATION'])
|
73
|
-
repeat = self['
|
74
|
-
repeat = 1 if repeat
|
73
|
+
repeat = self['REPEAT'].to_s.to_i
|
74
|
+
repeat = 1 if repeat == 0
|
75
75
|
|
76
76
|
occurrence = effective_trigger
|
77
|
-
|
78
|
-
|
77
|
+
return true if start <= occurrence && ending > occurrence
|
78
|
+
|
79
|
+
repeat.times do |_i|
|
79
80
|
occurrence += duration
|
81
|
+
return true if start <= occurrence && ending > occurrence
|
80
82
|
end
|
81
83
|
return false
|
82
84
|
else
|
@@ -460,7 +460,7 @@ module Tilia
|
|
460
460
|
# Specifically, this will ensure all child elements are also cloned.
|
461
461
|
#
|
462
462
|
# @return void
|
463
|
-
def initialize_copy(
|
463
|
+
def initialize_copy(_original)
|
464
464
|
new_children = {}
|
465
465
|
@children.each do |child_name, child_group|
|
466
466
|
new_children[child_name] = []
|
@@ -582,6 +582,24 @@ module Tilia
|
|
582
582
|
messages
|
583
583
|
end
|
584
584
|
|
585
|
+
# Call this method on a document if you're done using it.
|
586
|
+
#
|
587
|
+
# It's intended to remove all circular references, so PHP can easily clean
|
588
|
+
# it up.
|
589
|
+
#
|
590
|
+
# @return void
|
591
|
+
def destroy
|
592
|
+
super
|
593
|
+
|
594
|
+
@children.each do |child_name, child_group|
|
595
|
+
child_group.each do |child|
|
596
|
+
child.destroy
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
@children = {}
|
601
|
+
end
|
602
|
+
|
585
603
|
# TODO: document
|
586
604
|
def to_s
|
587
605
|
serialize
|
@@ -10,22 +10,22 @@ module Tilia
|
|
10
10
|
# This class also provides a registry for document types.
|
11
11
|
class Document < Component
|
12
12
|
# Unknown document type.
|
13
|
-
UNKNOWN
|
13
|
+
UNKNOWN = 1
|
14
14
|
|
15
15
|
# vCalendar 1.0.
|
16
|
-
VCALENDAR10
|
16
|
+
VCALENDAR10 = 2
|
17
17
|
|
18
18
|
# iCalendar 2.0.
|
19
|
-
ICALENDAR20
|
19
|
+
ICALENDAR20 = 3
|
20
20
|
|
21
21
|
# vCard 2.1.
|
22
|
-
VCARD21
|
22
|
+
VCARD21 = 4
|
23
23
|
|
24
24
|
# vCard 3.0.
|
25
|
-
VCARD30
|
25
|
+
VCARD30 = 5
|
26
26
|
|
27
27
|
# vCard 4.0.
|
28
|
-
VCARD40
|
28
|
+
VCARD40 = 6
|
29
29
|
|
30
30
|
# The default name for this component.
|
31
31
|
#
|
data/lib/tilia/v_object/node.rb
CHANGED
@@ -9,21 +9,21 @@ module Tilia
|
|
9
9
|
#
|
10
10
|
# If REPAIR is set, the validator will attempt to repair any broken data
|
11
11
|
# (if possible).
|
12
|
-
REPAIR
|
12
|
+
REPAIR = 1
|
13
13
|
|
14
14
|
# If this option is set, the validator will operate on the vcards on the
|
15
15
|
# assumption that the vcards need to be valid for CardDAV.
|
16
16
|
#
|
17
17
|
# This means for example that the UID is required, whereas it is not for
|
18
18
|
# regular vcards.
|
19
|
-
PROFILE_CARDDAV
|
19
|
+
PROFILE_CARDDAV = 2
|
20
20
|
|
21
21
|
# If this option is set, the validator will operate on iCalendar objects
|
22
22
|
# on the assumption that the vcards need to be valid for CalDAV.
|
23
23
|
#
|
24
24
|
# This means for example that calendars can only contain objects with
|
25
25
|
# identical component types and UIDs.
|
26
|
-
PROFILE_CALDAV
|
26
|
+
PROFILE_CALDAV = 4
|
27
27
|
|
28
28
|
# Reference to the parent object, if this is not the top object.
|
29
29
|
#
|
@@ -57,6 +57,17 @@ module Tilia
|
|
57
57
|
def xml_serialize(_writer)
|
58
58
|
end
|
59
59
|
|
60
|
+
# Call this method on a document if you're done using it.
|
61
|
+
#
|
62
|
+
# It's intended to remove all circular references, so PHP can easily clean
|
63
|
+
# it up.
|
64
|
+
#
|
65
|
+
# @return void
|
66
|
+
def destroy
|
67
|
+
@parent = nil
|
68
|
+
@root = nil
|
69
|
+
end
|
70
|
+
|
60
71
|
# Validates the node for correctness.
|
61
72
|
#
|
62
73
|
# The following options are supported:
|
@@ -10,11 +10,11 @@ module Tilia
|
|
10
10
|
# In the case of the MimeDir parser, this means that the parser will
|
11
11
|
# accept slashes and underscores in property names, and it will also
|
12
12
|
# attempt to fix Microsoft vCard 2.1's broken line folding.
|
13
|
-
OPTION_FORGIVING
|
13
|
+
OPTION_FORGIVING = 1
|
14
14
|
|
15
15
|
# If this option is turned on, any lines we cannot parse will be ignored
|
16
16
|
# by the reader.
|
17
|
-
OPTION_IGNORE_INVALID_LINES
|
17
|
+
OPTION_IGNORE_INVALID_LINES = 2
|
18
18
|
|
19
19
|
# Bitmask of parser options.
|
20
20
|
#
|
@@ -7,8 +7,8 @@ module Tilia
|
|
7
7
|
class Xml < Parser
|
8
8
|
require 'tilia/v_object/parser/xml/element'
|
9
9
|
|
10
|
-
XCAL_NAMESPACE
|
11
|
-
XCARD_NAMESPACE
|
10
|
+
XCAL_NAMESPACE = 'urn:ietf:params:xml:ns:icalendar-2.0'
|
11
|
+
XCARD_NAMESPACE = 'urn:ietf:params:xml:ns:vcard-4.0'
|
12
12
|
|
13
13
|
# The input data.
|
14
14
|
#
|
@@ -408,7 +408,7 @@ module Tilia
|
|
408
408
|
# Specifically, this will ensure all child elements are also cloned.
|
409
409
|
#
|
410
410
|
# @return void
|
411
|
-
def initialize_copy(
|
411
|
+
def initialize_copy(_original)
|
412
412
|
new_params = {}
|
413
413
|
@parameters.each do |key, child|
|
414
414
|
new_params[key] = child.clone
|
@@ -519,6 +519,22 @@ module Tilia
|
|
519
519
|
warnings
|
520
520
|
end
|
521
521
|
|
522
|
+
# Call this method on a document if you're done using it.
|
523
|
+
#
|
524
|
+
# It's intended to remove all circular references, so PHP can easily clean
|
525
|
+
# it up.
|
526
|
+
#
|
527
|
+
# @return void
|
528
|
+
def destroy
|
529
|
+
super
|
530
|
+
|
531
|
+
@parameters.each do |_name, param|
|
532
|
+
param.destroy
|
533
|
+
end
|
534
|
+
|
535
|
+
@parameters = {}
|
536
|
+
end
|
537
|
+
|
522
538
|
# TODO: document
|
523
539
|
def ==(other)
|
524
540
|
if other.is_a?(String)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tilia-vobject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.pre.
|
4
|
+
version: 4.0.0.pre.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakob Sack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilia-xml
|