canon 0.3.34 → 0.3.35
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
- data/lib/canon/version.rb +1 -1
- data/lib/canon/xml/element_matcher.rb +27 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 746a0b0b72cc9111986fb3aab9b8c5de994d71b30a011983665b5a24130b092c
|
|
4
|
+
data.tar.gz: e9e5a262b99c0e44c2f11385e911faaf5216b52f32bc027d1a0ae82f0bae985e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9edbbe4c9eb6adb6218b2d282f1ac030fa4642ece72cedae34b54ea6cbac987acfd46bebbf1277da017b4bfcf511be98f41c64951fee9d7034d1410f8414a38b
|
|
7
|
+
data.tar.gz: 23d088e8fb394d5f36553b64f9e05955f788ca85615147878d6116552ed2ac3b297ebdc739604de009c754a5a8600a57cad97668c6c325a018635d6c6010df04
|
data/lib/canon/version.rb
CHANGED
|
@@ -447,7 +447,16 @@ module Canon
|
|
|
447
447
|
map = {}
|
|
448
448
|
|
|
449
449
|
elements.each do |elem|
|
|
450
|
-
class_attr =
|
|
450
|
+
class_attr = nil
|
|
451
|
+
attrs = elem.attribute_nodes
|
|
452
|
+
j = 0
|
|
453
|
+
while j < attrs.length
|
|
454
|
+
if attrs[j].name == "class"
|
|
455
|
+
class_attr = attrs[j]
|
|
456
|
+
break
|
|
457
|
+
end
|
|
458
|
+
j += 1
|
|
459
|
+
end
|
|
451
460
|
next unless class_attr
|
|
452
461
|
|
|
453
462
|
# Use element name + class as key to handle multiple element types
|
|
@@ -458,11 +467,24 @@ module Canon
|
|
|
458
467
|
map
|
|
459
468
|
end
|
|
460
469
|
|
|
461
|
-
# Extract identity from element attributes
|
|
470
|
+
# Extract identity from element attributes. Index loops, not
|
|
471
|
+
# find/detect blocks — Enumerable#find allocates ~3 objects per
|
|
472
|
+
# call on CRuby 3.4 and this runs per element (both sides) on
|
|
473
|
+
# every comparison level.
|
|
462
474
|
def extract_identity(elem)
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
475
|
+
attrs = elem.attribute_nodes
|
|
476
|
+
i = 0
|
|
477
|
+
identity_count = @identity_attrs.length
|
|
478
|
+
while i < identity_count
|
|
479
|
+
attr_name = @identity_attrs[i]
|
|
480
|
+
j = 0
|
|
481
|
+
attr_count = attrs.length
|
|
482
|
+
while j < attr_count
|
|
483
|
+
return attrs[j].value if attrs[j].name == attr_name
|
|
484
|
+
|
|
485
|
+
j += 1
|
|
486
|
+
end
|
|
487
|
+
i += 1
|
|
466
488
|
end
|
|
467
489
|
nil
|
|
468
490
|
end
|