backtrack-xpath 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/backtrack-xpath.rb +13 -5
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a37abfa337e4dc950626618d32b92cb3f9d9926382a42c9568a09038124b38
|
4
|
+
data.tar.gz: 627535a1133530d6f989a1c665d85d06dc55dc8afc9164c841b1a2770ea8649b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b496a620931154556171eec1814f452862524ce56891ac91a39ad759f054385e1ce0bcb27e46c22bbc508b18cab59efce65c77e64c7d26e411696247d828736
|
7
|
+
data.tar.gz: ffd7781ded84b5f8b220f192a542c6ada759bbc74ec0c1663d0313b02c9e1bca1869f0ec249d500b1f21b3d2bb63472975ba614a8858117384eca07d9b5783e9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/backtrack-xpath.rb
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
|
7
7
|
class BacktrackXPath
|
8
8
|
|
9
|
-
def initialize(node, use_attributes: true)
|
9
|
+
def initialize(node, use_attributes: true, ignore_id: false)
|
10
10
|
|
11
|
-
@use_attributes = use_attributes
|
11
|
+
@use_attributes, @ignore_id = use_attributes, ignore_id
|
12
12
|
@xpath = doc_scan(node).flatten.compact.join('/')
|
13
13
|
|
14
14
|
end
|
@@ -24,12 +24,20 @@ class BacktrackXPath
|
|
24
24
|
def attribute_scan(node)
|
25
25
|
|
26
26
|
result = ''
|
27
|
-
|
27
|
+
|
28
|
+
list = @ignore_id ? [:class,'class'] : [:id, :class, 'id', 'class']
|
29
|
+
attr = list.detect {|x| node.attributes.has_key? x}
|
28
30
|
|
29
31
|
if attr then
|
30
32
|
node.attribute(attr)
|
31
|
-
|
32
|
-
|
33
|
+
|
34
|
+
value = if attr.to_sym == :id then
|
35
|
+
node.attributes[attr]
|
36
|
+
else
|
37
|
+
attrval = node.attributes[attr]
|
38
|
+
attrval[0] if attrval.is_a? Array
|
39
|
+
end
|
40
|
+
|
33
41
|
result = "[@%s='%s']" % [attr, value]
|
34
42
|
end
|
35
43
|
result
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backtrack-xpath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
5MjLlGBVVCgY+fcP9/LOMd6fIN4FqphZXBGDCU4yiYRkly9ypopXqKp18RHhmwYG
|
36
36
|
18S2R4wYTVQb7BF+vRvuy3rQ
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-01-
|
38
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
39
39
|
dependencies: []
|
40
40
|
description:
|
41
41
|
email: digital.robertson@gmail.com
|
metadata.gz.sig
CHANGED
Binary file
|