rexle 0.9.78 → 0.9.79
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 +4 -4
- checksums.yaml.gz.sig +3 -2
- data.tar.gz.sig +0 -0
- data/lib/rexle.rb +34 -11
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1aece67407d9a24d7b601a7a4d2d1a88c791e0e
|
4
|
+
data.tar.gz: c85716dd099bdeddb1e885f8966882fc73e709bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf56e4473638d05101f0c48ddd92fb73d8b3d8f6ef75dc2ef558e7bc0e55b1db431a903fccd08062744c2aca8de3127348018f7c0fe2d52aac0b1292f615667
|
7
|
+
data.tar.gz: ce88784039d418f4e83f0cad51f9f00425b2988f36ba566781c4b4d49f22e97c39ac9c8b58dc5c1931a755785feecd4a5d9e75c07cabecbac9a0cb5cd35eed03
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
��<; ����G{�=�3��hf
|
2
|
+
�6�+��#�z� �u����ݳ��K�t2�E��]��"$mW��i�H_Q2l��jF,�L��V@�4`o�
|
3
|
+
Cw�a�����/{3�#k����A��=��ȕL�W�\r膸�E|Ȗ�@Ǚj�K���l�o�i M�,j;"d�c2�L䭃���g��+��z�����O�����q-O�X�k8��+W3J�)Rn"0|����3_cX\�r5�� �h�a�k0�<ǂw�xK�-]�
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexle.rb
CHANGED
@@ -11,9 +11,8 @@ include REXML
|
|
11
11
|
|
12
12
|
# modifications:
|
13
13
|
|
14
|
-
# 05-Nov-2013:
|
15
|
-
#
|
16
|
-
# within the doc
|
14
|
+
# 05-Nov-2013: If a node is added to the document which already exists in the
|
15
|
+
# node, it will be moved accordingly.
|
17
16
|
# 05-Nov02013: XPath bug fix: recursive selector with conditional parent now
|
18
17
|
# returns the correct child e.g. //b[2]/c
|
19
18
|
# 10-Oct-2013: bug fix: child elements which have the same name as their parent
|
@@ -199,11 +198,12 @@ class Rexle
|
|
199
198
|
include XMLhelper
|
200
199
|
|
201
200
|
attr_accessor :name, :value, :parent
|
202
|
-
attr_reader :child_lookup, :child_elements
|
201
|
+
attr_reader :child_lookup, :child_elements, :doc_id
|
203
202
|
|
204
203
|
alias original_clone clone
|
205
204
|
|
206
205
|
def initialize(name=nil, value='', attributes={}, rexle=nil)
|
206
|
+
|
207
207
|
@rexle = rexle
|
208
208
|
super()
|
209
209
|
@name, @value, @attributes = name.to_s, value, attributes
|
@@ -441,6 +441,7 @@ class Rexle
|
|
441
441
|
end
|
442
442
|
|
443
443
|
def add_element(item)
|
444
|
+
|
444
445
|
if item.is_a? Rexle::Element then
|
445
446
|
|
446
447
|
@child_lookup << [item.name, item.attributes, item.value]
|
@@ -454,7 +455,27 @@ class Rexle
|
|
454
455
|
elsif item.is_a? Rexle then
|
455
456
|
self.add_element(item.root)
|
456
457
|
end
|
457
|
-
end
|
458
|
+
end
|
459
|
+
|
460
|
+
def add(item)
|
461
|
+
|
462
|
+
if item.is_a? Rexle::Element then
|
463
|
+
|
464
|
+
if self.doc_id == item.doc_id then
|
465
|
+
|
466
|
+
new_item = item.deep_clone
|
467
|
+
add_element new_item
|
468
|
+
item.delete
|
469
|
+
item = new_item
|
470
|
+
new_item
|
471
|
+
else
|
472
|
+
add_element item
|
473
|
+
end
|
474
|
+
else
|
475
|
+
add_element item
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|
458
479
|
|
459
480
|
def inspect()
|
460
481
|
if self.xml.length > 30 then
|
@@ -464,7 +485,7 @@ class Rexle
|
|
464
485
|
end
|
465
486
|
end
|
466
487
|
|
467
|
-
alias add add_element
|
488
|
+
#alias add add_element
|
468
489
|
|
469
490
|
def add_attribute(*x)
|
470
491
|
|
@@ -620,13 +641,13 @@ class Rexle
|
|
620
641
|
|
621
642
|
i = parent.child_elements.index(self)
|
622
643
|
return unless i
|
623
|
-
new_node = node.deep_clone
|
624
644
|
|
625
|
-
|
626
|
-
node
|
627
|
-
|
645
|
+
parent.child_elements.insert(i+offset, node)
|
646
|
+
parent.child_lookup.insert(i+offset, [node.name, node.attributes, node.value])
|
647
|
+
|
648
|
+
@doc_id = self.doc_root.object_id
|
649
|
+
node.instance_variable_set(:@doc_id, self.doc_root.object_id)
|
628
650
|
|
629
|
-
parent.child_lookup.insert(i+offset, [new_node.name, new_node.attributes, new_node.value])
|
630
651
|
self
|
631
652
|
end
|
632
653
|
|
@@ -810,10 +831,12 @@ class Rexle
|
|
810
831
|
def attributes() @doc.attributes end
|
811
832
|
|
812
833
|
def add_element(element)
|
834
|
+
|
813
835
|
if @doc then
|
814
836
|
raise 'attempted adding second root element to document' if @doc.root
|
815
837
|
@doc.root.add_element(element)
|
816
838
|
else
|
839
|
+
|
817
840
|
doc_node = ['doc', '', {}, element.to_a]
|
818
841
|
@doc = scan_element(*doc_node)
|
819
842
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|