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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd772e0719f0fd9aa0ecdff1d8e0fa8d095cf1bf
4
- data.tar.gz: 11d9f1799d62e8db0d8badf5612d9cc1382a6d1f
3
+ metadata.gz: 61da0cdbbfd699e274a143595129d7fcbfbf5bd7
4
+ data.tar.gz: 36d141bd9ff0e17672d1c232b84b915244a49747
5
5
  SHA512:
6
- metadata.gz: 4bca7e3ffbcaa3e2191734796acb164f6377a493e30c9a0ea3751bf203fba1ee5a0e4925c338d5a52244021b41c82427ab844884e2a779e9b01d21c893761f6b
7
- data.tar.gz: a6dc153d2cdffa79db23d9a4d9274afd67065f5643fcaa2b0e13aecfb96b86e8869b04da4e6ea311526c864ffc50027ae4035d0b34e0694a0b371771efd14e11
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
- predicate = xpath_instructions.flatten.first.to_s == 'predicate'
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.10
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-21 00:00:00.000000000 Z
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.4.8
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