rexle-xpath 0.2.10 → 0.2.11
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.tar.gz.sig +0 -0
- data/lib/rexle-xpath.rb +21 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61da0cdbbfd699e274a143595129d7fcbfbf5bd7
|
4
|
+
data.tar.gz: 36d141bd9ff0e17672d1c232b84b915244a49747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f05b9707cfa765f7824d634b12574b204f7c0de5f510e11971856f63a4984a5211a79b4b125aacaedbe02310a8c13dbe46721e8bd8a488bd540fb503ef8e0e0
|
7
|
+
data.tar.gz: be2cb26d7d4e5fae330f79dbd6df76900bc5d3ee90502aa788cd9de6e629add7c02be4ae4cbe9d001738aa5f274be520f1ef46d033274ffa5e6e8e57941a3da1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rexle-xpath.rb
CHANGED
@@ -85,6 +85,17 @@ class RexleXPath
|
|
85
85
|
[r.length]
|
86
86
|
end
|
87
87
|
|
88
|
+
def index(node, args, xpath_instructions)
|
89
|
+
|
90
|
+
debug :index, node: node, args: args,
|
91
|
+
xpath_instructions: xpath_instructions
|
92
|
+
|
93
|
+
i = args.first.to_i
|
94
|
+
r = query node, xpath_instructions
|
95
|
+
|
96
|
+
[r[i-1]]
|
97
|
+
end
|
98
|
+
|
88
99
|
def not(node, args, xpath_instructions)
|
89
100
|
|
90
101
|
r = query node, xpath_instructions
|
@@ -118,7 +129,16 @@ class RexleXPath
|
|
118
129
|
def select(node, args, xpath_instructions)
|
119
130
|
|
120
131
|
a = node.elements.select {|x| x.name == args.first }
|
121
|
-
|
132
|
+
flat_xpi = xpath_instructions.flatten
|
133
|
+
|
134
|
+
predicate = flat_xpi.first.to_s == 'predicate'
|
135
|
+
|
136
|
+
if predicate and flat_xpi[1] == :index then
|
137
|
+
|
138
|
+
i = flat_xpi[2].to_i - 1
|
139
|
+
return a[i]
|
140
|
+
|
141
|
+
end
|
122
142
|
|
123
143
|
if xpath_instructions.any? and a.any? then
|
124
144
|
|
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.
|
4
|
+
version: 0.2.11
|
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-
|
34
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle-xpath-parser
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.5.1
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Under development, and is not currently used by the Rexle gem.
|
metadata.gz.sig
CHANGED
Binary file
|