tilia-vobject 4.0.0.pre.alpha2 → 4.0.0.pre.alpha3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93752908dd3fe5f2eb4e779f3b502f2a9188748a
4
- data.tar.gz: 4920f43108b370cd96c113fe3afe9884c740835b
3
+ metadata.gz: 8900d4d2faaf438d17e6923a26592c4ee2f27774
4
+ data.tar.gz: b0be93b82f5ccc6c0e9f946e049779f9c7bb3e8a
5
5
  SHA512:
6
- metadata.gz: 69c4ba324840c8ccee64989a1f77b67c3ebae5fea404bbc5eeb0ece7895b190ef95e5d758854af86d94d57a2fc7f50508e312b28156d62a3bd2d3567afac4ac2
7
- data.tar.gz: a3f12529cf63684643432cc8a36f292c8e7b947ece7692e3173db95acb65a2149d40720ee7de01a0f6f75978eb8bc79adbf6a7a542362d03832bbbebba2ae5b7
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['repeat']
74
- repeat = 1 if repeat.blank?
73
+ repeat = self['REPEAT'].to_s.to_i
74
+ repeat = 1 if repeat == 0
75
75
 
76
76
  occurrence = effective_trigger
77
- repeat.to_s.to_i.times do |_i|
78
- return true if start <= occurrence && ending > occurrence
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
@@ -153,7 +153,7 @@ module Tilia
153
153
  # VCards with version 2.1, 3.0 and 4.0 are found.
154
154
  #
155
155
  # If the VCARD doesn't know its version, 2.1 is assumed.
156
- DEFAULT_VERSION ||= VCARD21
156
+ DEFAULT_VERSION = VCARD21
157
157
 
158
158
  # Validates the node for correctness.
159
159
  #
@@ -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(_other)
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 ||= 1
13
+ UNKNOWN = 1
14
14
 
15
15
  # vCalendar 1.0.
16
- VCALENDAR10 ||= 2
16
+ VCALENDAR10 = 2
17
17
 
18
18
  # iCalendar 2.0.
19
- ICALENDAR20 ||= 3
19
+ ICALENDAR20 = 3
20
20
 
21
21
  # vCard 2.1.
22
- VCARD21 ||= 4
22
+ VCARD21 = 4
23
23
 
24
24
  # vCard 3.0.
25
- VCARD30 ||= 5
25
+ VCARD30 = 5
26
26
 
27
27
  # vCard 4.0.
28
- VCARD40 ||= 6
28
+ VCARD40 = 6
29
29
 
30
30
  # The default name for this component.
31
31
  #
@@ -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 ||= 1
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 ||= 2
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 ||= 4
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 ||= 1
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 ||= 2
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 ||= 'urn:ietf:params:xml:ns:icalendar-2.0'
11
- XCARD_NAMESPACE ||= 'urn:ietf:params:xml:ns:vcard-4.0'
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(_other)
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)
@@ -3,7 +3,7 @@ module Tilia
3
3
  # This class contains the version number for the VObject package.
4
4
  class Version
5
5
  # Full version number.
6
- VERSION = '4.0.0-alpha2'
6
+ VERSION = '4.0.0-alpha3'
7
7
  end
8
8
  end
9
9
  end
@@ -62,9 +62,9 @@ module Tilia
62
62
  event.add(prop)
63
63
  assert_equal(event, prop.parent)
64
64
 
65
- # TODO: destroy object?!
66
- # vcal.destroy
67
- # assert_nil(prop.parent)
65
+ vcal.destroy
66
+
67
+ assert_nil(prop.parent)
68
68
  end
69
69
  end
70
70
  end
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.alpha2
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: 2015-12-24 00:00:00.000000000 Z
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilia-xml