backtrack-xpath 0.1.7 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/backtrack-xpath.rb +19 -7
- data.tar.gz.sig +0 -0
- metadata +28 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4b228b2f1143eeaa3a03d27a4f3859f9e02d397613b1d7e67dae95652750f973
|
4
|
+
data.tar.gz: a773a87839802fc7d8d6ee294f0b84d1469346eb639a883f85a65f66557f1160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '081fc519ec340b3ccd0f5484a0549c753bf0c79f21b5ff871c5a1c6923158db1eb6b232a18f95f763f4205de5895311bd35bda989dc394888826fb5ec3399e1f'
|
7
|
+
data.tar.gz: 0b4eb65aa929dcc9a6f74777c4d951d37f9862d3f995eff1a8853a24a2c40bcf4081d6887ba695e2b5e49b32da299421be03bfb277c0372237bb4f4477f11fa9
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/backtrack-xpath.rb
CHANGED
@@ -6,8 +6,11 @@
|
|
6
6
|
|
7
7
|
class BacktrackXPath
|
8
8
|
|
9
|
-
def initialize(node)
|
9
|
+
def initialize(node, use_attributes: true, ignore_id: false)
|
10
|
+
|
11
|
+
@use_attributes, @ignore_id = use_attributes, ignore_id
|
10
12
|
@xpath = doc_scan(node).flatten.compact.join('/')
|
13
|
+
|
11
14
|
end
|
12
15
|
|
13
16
|
def to_s
|
@@ -21,23 +24,32 @@ class BacktrackXPath
|
|
21
24
|
def attribute_scan(node)
|
22
25
|
|
23
26
|
result = ''
|
24
|
-
|
25
|
-
|
27
|
+
|
28
|
+
list = @ignore_id ? [:class,'class'] : [:id, :class, 'id', 'class']
|
29
|
+
attr = list.detect {|x| node.attributes.has_key? x}
|
30
|
+
|
26
31
|
if attr then
|
27
32
|
node.attribute(attr)
|
28
|
-
|
29
|
-
|
33
|
+
|
34
|
+
value = if attr.to_sym == :id then
|
35
|
+
node.attributes[attr]
|
36
|
+
else
|
37
|
+
attrval = node.attributes[attr]
|
38
|
+
attrval[-1] if attrval.is_a? Array
|
39
|
+
end
|
40
|
+
|
30
41
|
result = "[@%s='%s']" % [attr, value]
|
31
42
|
end
|
32
43
|
result
|
33
44
|
end
|
34
45
|
|
35
46
|
def doc_scan(node)
|
36
|
-
|
47
|
+
|
37
48
|
return unless node.parent
|
38
49
|
|
39
50
|
name = node.name
|
40
|
-
|
51
|
+
|
52
|
+
attribute = (@use_attributes and node.attributes) ? attribute_scan(node) : ''
|
41
53
|
result = doc_scan(node.parent)
|
42
54
|
|
43
55
|
[result, name + attribute]
|
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.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,31 +10,35 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMTIxMTk1NTA3WhcN
|
15
|
+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hIQJHF0Bmqjs4gAvh3RbQ5bAS
|
30
|
+
XqZTkMEio2SXzwX1WgTX3VG7pW/6+kOSP1q/Htc6/P9J1oUGy2wSPRi+2DX+Tl4h
|
31
|
+
Owb13ebVFuehxCVBh415nzSYnYDRhVMdiWYmbbIKQf9GCCGYFk5u83C795plJiJg
|
32
|
+
qnYEYiqdGRPYA/C6Pu7VNVgFpzDgfh0yA5Fgs8qEcv1sYfqDuLAPHoM/SHCach/j
|
33
|
+
VQ6cnUM8389cUCrEK3yk6DuAzivi5bNQTZOi+b1GrQSavVDyupRDdxe1s+yc7EmF
|
34
|
+
k47aFQDjEdgil327V8d7CHpZyGun3JJbYWOuSu4Q9v0DzARh8ObNrPmpALNuj3mC
|
35
|
+
5MjLlGBVVCgY+fcP9/LOMd6fIN4FqphZXBGDCU4yiYRkly9ypopXqKp18RHhmwYG
|
36
|
+
18S2R4wYTVQb7BF+vRvuy3rQ
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2022-01-23 00:00:00.000000000 Z
|
35
39
|
dependencies: []
|
36
40
|
description:
|
37
|
-
email:
|
41
|
+
email: digital.robertson@gmail.com
|
38
42
|
executables: []
|
39
43
|
extensions: []
|
40
44
|
extra_rdoc_files: []
|
@@ -60,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
64
|
version: '0'
|
61
65
|
requirements: []
|
62
66
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.7.10
|
64
68
|
signing_key:
|
65
69
|
specification_version: 4
|
66
70
|
summary: backtrack-xpath accepts a REXML::Element and returns the full XPath back
|
metadata.gz.sig
CHANGED
Binary file
|