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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 171b32b032bbce5608ae3bc62979fd748cfa9baf
4
- data.tar.gz: 07b15e3269758bba8603dfb22133c980b65b5698
2
+ SHA256:
3
+ metadata.gz: 64b44c4ffb4faa746a713bbd3a82835d0a09f3e5e1b7870e35a610cc0823965c
4
+ data.tar.gz: 22e93bf796cc167532a437ce6fd799a31ba9e07dae09652f709be45e6c5f2414
5
5
  SHA512:
6
- metadata.gz: 35491e81367e8a56180c16f89f5301fe9f942c94f557f86f19e86923bc8e344e5b2c3b9ffbb5d69309cd0a2ae40e43a49d5c7f8bfc1c0e4894cf6371462b1a91
7
- data.tar.gz: 211b70808bf834c3ba3326102f69a75a7c71883e75f798c86155d0da92f12cf59ff8c7bc5fa49e52de100008e814d4b904f3e3e3b67ae418a8803198422dac68
6
+ metadata.gz: 5cf31265c9c151d9863708f9cecc4750e4e08de53b0581b14b95cedab53fc5a222a04a5056f2a3452d0268f338fd939ed48daa43add20e4d147b614c089cafd7
7
+ data.tar.gz: 46523b268e5d0e796878c1fac63b21cd6719753cfda6102e47ca93714acfb115a435ba68937f0912645d18ac59a992127784a96618311c9fc69e276f48d1e2e4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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 = %w(id class).detect {|x| node.attributes.has_key? x}
27
+ attr = [:id, :class, 'id', 'class'].detect {|x| node.attributes.has_key? x}
28
+
23
29
  if attr then
24
- value = node.attribute(attr).value
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
- attribute = node.attributes ? attribute_scan(node) : ''
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.1.5
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
- MIIDRDCCAiygAwIBAgIBADANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTEzMDIwNjIwNTM0NVoXDTE0MDIwNjIwNTM0NVowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAMF83KZLW/AqbNzjFAd+h5ggr48fNkQBN+Zb40zRryOSrqKQ5CF9sOWHWB/n
19
- UIn5L2pGwcfl2BweSfa2PYJElrcLw1eLDqtLRDTbzG6guGsSrK4hR5cq1tS90XXb
20
- eBE4Rx3b2p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DuAzivi5bNQTZOi+b1GrQSavVDyupRDdxe1s+yc7EmF
34
+ k47aFQDjEdgil327V8d7CHpZyGun3JJbYWOuSu4Q9v0DzARh8ObNrPmpALNuj3mC
35
+ 5MjLlGBVVCgY+fcP9/LOMd6fIN4FqphZXBGDCU4yiYRkly9ypopXqKp18RHhmwYG
36
+ 18S2R4wYTVQb7BF+vRvuy3rQ
31
37
  -----END CERTIFICATE-----
32
- date: 2013-10-09 00:00:00.000000000 Z
38
+ date: 2022-01-21 00:00:00.000000000 Z
33
39
  dependencies: []
34
40
  description:
35
- email: james@r0bertson.co.uk
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: '0'
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.0.0.rc.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