rexle-xpath 0.2.13 → 0.2.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d4007487547f7b0f7fb68a76cfb7fd1a8874517
4
- data.tar.gz: 14422d54c789930a6175158910adf52ce4c4a70b
3
+ metadata.gz: 5135103f6e958d5f0a6e6ad07d768f3af2d2a420
4
+ data.tar.gz: e5a751d21332e1aaec6cc59882347c3361c5e24f
5
5
  SHA512:
6
- metadata.gz: 38453d905aa27badd643941901d433068da7980be5a1f4b9d6650ab1ff822492bd5f620336d6691728a25ec3115ee5632baa7e6e39ddd25713e3ee46c107da62
7
- data.tar.gz: e302f65667fc1df02ba00c3bd188dba19c81f767752e7057a2152bff2911e930862da20e32cdabcca19044d7174260975ce03546d5740b7245e55cad3d3b1ec6
6
+ metadata.gz: ab0e89d915d782ceba46e46967e504a6d5d0f548db8cf6b39fc3a5404d0d74554768a191a78149d43fcf7e6ea799b6f6d22fbc2f99529596aa30b43f8f968ccf
7
+ data.tar.gz: 860bf5772638d7070a940f0bb9ed90262ca9d9845e3fe5c6f51c15633121ab5596b90f4f62128d0231716729bf3fe77601c9ae71f8a921d373e914ab079b9271
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rexle-xpath.rb CHANGED
@@ -22,7 +22,6 @@ class RexleXPath
22
22
 
23
23
  def initialize(node=nil, debug: false)
24
24
 
25
-
26
25
  @node = node
27
26
  @debug = debug
28
27
 
@@ -57,9 +56,10 @@ class RexleXPath
57
56
  row = xpath_instructions.shift
58
57
  method_name, *args = row
59
58
 
60
- return query node, row if row.first.is_a? Array
59
+ return query node, row + xpath_instructions if row.first.is_a? Array
61
60
 
62
61
  result = method(method_name.to_sym).call node, args, xpath_instructions
62
+
63
63
  result.is_a?(Array) ? result.flatten : result
64
64
 
65
65
  end
@@ -139,6 +139,7 @@ class RexleXPath
139
139
  xpath_instructions: xpath_instructions
140
140
 
141
141
  nodes_found = node.elements.select {|x| x.name == args.first }
142
+
142
143
  flat_xpi = xpath_instructions.flatten
143
144
 
144
145
  predicate = flat_xpi.first.to_s == 'predicate'
@@ -181,15 +182,14 @@ class RexleXPath
181
182
 
182
183
  end
183
184
 
184
- def text(node, args, xpath_instructions)
185
- node.text
186
- end
187
-
188
185
  def value(node, args, xpath_instructions)
189
186
 
190
187
  operator, operand = args
191
-
192
- node.value.method(operator.to_sym).call operand
188
+ if operator then
189
+ node.value.method(operator.to_sym).call operand
190
+ else
191
+ [node.text]
192
+ end
193
193
 
194
194
  end
195
195
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle-xpath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  05Hvy/ad61XnzWtun98claEIk/rC/TxPrbRaOd7vN99WxTy1xn8ElfLSx7CDDrTc
32
32
  qN5t1BlRcAgKNw==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-05-25 00:00:00.000000000 Z
34
+ date: 2016-05-26 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexle-xpath-parser
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.1'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.1.3
45
+ version: 0.1.13
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '0.1'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.1.3
55
+ version: 0.1.13
56
56
  description:
57
57
  email: james@r0bertson.co.uk
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file