backtrack-xpath 0.1.5 → 0.2.0
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 +15 -6
- data.tar.gz.sig +0 -0
- metadata +29 -23
- 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: 64b44c4ffb4faa746a713bbd3a82835d0a09f3e5e1b7870e35a610cc0823965c
|
4
|
+
data.tar.gz: 22e93bf796cc167532a437ce6fd799a31ba9e07dae09652f709be45e6c5f2414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cf31265c9c151d9863708f9cecc4750e4e08de53b0581b14b95cedab53fc5a222a04a5056f2a3452d0268f338fd939ed48daa43add20e4d147b614c089cafd7
|
7
|
+
data.tar.gz: 46523b268e5d0e796878c1fac63b21cd6719753cfda6102e47ca93714acfb115a435ba68937f0912645d18ac59a992127784a96618311c9fc69e276f48d1e2e4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/backtrack-xpath.rb
CHANGED
@@ -2,10 +2,15 @@
|
|
2
2
|
|
3
3
|
# file: backtrack-xpath.rb
|
4
4
|
|
5
|
+
# for use with the Rexle gem
|
6
|
+
|
5
7
|
class BacktrackXPath
|
6
8
|
|
7
|
-
def initialize(node)
|
9
|
+
def initialize(node, use_attributes: true)
|
10
|
+
|
11
|
+
@use_attributes = use_attributes
|
8
12
|
@xpath = doc_scan(node).flatten.compact.join('/')
|
13
|
+
|
9
14
|
end
|
10
15
|
|
11
16
|
def to_s
|
@@ -19,22 +24,26 @@ class BacktrackXPath
|
|
19
24
|
def attribute_scan(node)
|
20
25
|
|
21
26
|
result = ''
|
22
|
-
attr =
|
27
|
+
attr = [:id, :class, 'id', 'class'].detect {|x| node.attributes.has_key? x}
|
28
|
+
|
23
29
|
if attr then
|
24
|
-
|
30
|
+
node.attribute(attr)
|
31
|
+
value = attr.to_sym == :id ? node.attributes[attr] : \
|
32
|
+
node.attributes[attr][0]
|
25
33
|
result = "[@%s='%s']" % [attr, value]
|
26
34
|
end
|
27
35
|
result
|
28
36
|
end
|
29
37
|
|
30
38
|
def doc_scan(node)
|
31
|
-
|
39
|
+
|
32
40
|
return unless node.parent
|
33
41
|
|
34
42
|
name = node.name
|
35
|
-
|
43
|
+
|
44
|
+
attribute = (@use_attributes and node.attributes) ? attribute_scan(node) : ''
|
36
45
|
result = doc_scan(node.parent)
|
37
46
|
|
38
47
|
[result, name + attribute]
|
39
48
|
end
|
40
|
-
end
|
49
|
+
end
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,29 +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
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMTIxMTk1NTA3WhcN
|
15
|
+
MjMwMTIxMTk1NTA3WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb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J1oUGy2wSPRi+2DX+Tl4h
|
31
|
+
Owb13ebVFuehxCVBh415nzSYnYDRhVMdiWYmbbIKQf9GCCGYFk5u83C795plJiJg
|
32
|
+
qnYEYiqdGRPYA/C6Pu7VNVgFpzDgfh0yA5Fgs8qEcv1sYfqDuLAPHoM/SHCach/j
|
33
|
+
VQ6cnUM8389cUCrEK3yk6DuAzivi5bNQTZOi+b1GrQSavVDyupRDdxe1s+yc7EmF
|
34
|
+
k47aFQDjEdgil327V8d7CHpZyGun3JJbYWOuSu4Q9v0DzARh8ObNrPmpALNuj3mC
|
35
|
+
5MjLlGBVVCgY+fcP9/LOMd6fIN4FqphZXBGDCU4yiYRkly9ypopXqKp18RHhmwYG
|
36
|
+
18S2R4wYTVQb7BF+vRvuy3rQ
|
31
37
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
38
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
33
39
|
dependencies: []
|
34
40
|
description:
|
35
|
-
email:
|
41
|
+
email: digital.robertson@gmail.com
|
36
42
|
executables: []
|
37
43
|
extensions: []
|
38
44
|
extra_rdoc_files: []
|
@@ -50,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
56
|
requirements:
|
51
57
|
- - ">="
|
52
58
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
59
|
+
version: 2.1.2
|
54
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
61
|
requirements:
|
56
62
|
- - ">="
|
@@ -58,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
64
|
version: '0'
|
59
65
|
requirements: []
|
60
66
|
rubyforge_project:
|
61
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.7.10
|
62
68
|
signing_key:
|
63
69
|
specification_version: 4
|
64
70
|
summary: backtrack-xpath accepts a REXML::Element and returns the full XPath back
|
metadata.gz.sig
CHANGED
Binary file
|