ox 2.9.1 → 2.9.2

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
  SHA256:
3
- metadata.gz: aeeadfb226235eca22604cef667feaa8e0331bbe101596394dd9f308cc1095e4
4
- data.tar.gz: 91ce6eac0ca75791f106246eff0456f79e21fd5782bc8cad1235b58f9639a0be
3
+ metadata.gz: cb02e4bfe5c3553796c87488d1a973e5d0c7774391352c85558776b462a722ed
4
+ data.tar.gz: 860e2ce73ed2f755140241bf211ce26425e8bb49ce1d3d1263b72a2f3e48dc44
5
5
  SHA512:
6
- metadata.gz: 53054044ddf3c9d7addc505391e0eb2061d1a2f73e35ca69cea7216e523ce89cce5c6ae8a0f3f836dec9c78fa17861c366d4fe627f32289fba3bc04bb4eeda6d
7
- data.tar.gz: 560ef09372d68fdb43182a8725c80ebecbc8cc778b6b64feb1c316bff47880ea1f5be2cf45528dc6c7f6078a9ffb15c493d4f39fa416c57fb55872da9f5c203e
6
+ metadata.gz: 7bbbd7e22da84b169665e1633f8ad0f533ea500e01d5712282dbe1921d346bdcfd3dc51b918d6cbe241fa54d2b45b35a42553f44a0308f0d54e186e58d363fc2
7
+ data.tar.gz: f45f9c90c1875965a4c0900334861d9416c888fe420b8343139abf09c2daaf51a4e56f2fd2abcb1229f33864c5ee3f2f37bc5a7caa42bd3d22685c942976de49
@@ -1,4 +1,10 @@
1
1
 
2
+ ## 2.9.2 - April 16, 2018
3
+
4
+ - `locate` fixed to cover a missing condition with named child thanks to mberlanda.
5
+
6
+ - `locate` supports attribute exists searches thanks to mberlanda.
7
+
2
8
  ## 2.9.1 - April 14, 2018
3
9
 
4
10
  - `prepend_child` added by mberlanda.
@@ -158,7 +158,10 @@ module Ox
158
158
  # * <code>element.locate("Family/Pete/*")</code> returns all children of the Pete Element.
159
159
  # * <code>element.locate("Family/?[1]")</code> returns the first element in the Family Element.
160
160
  # * <code>element.locate("Family/?[<3]")</code> returns the first 3 elements in the Family Element.
161
+ # * <code>element.locate("Family/?[@age]")</code> returns the elements with an age attribute defined in the Family Element.
162
+ # * <code>element.locate("Family/Kid[@age]")</code> returns the Kid elements with an age attribute defined in the Family Element.
161
163
  # * <code>element.locate("Family/?[@age=32]")</code> returns the elements with an age attribute equal to 32 in the Family Element.
164
+ # * <code>element.locate("Family/Kid[@age=32]")</code> returns the Kid elements with an age attribute equal to 32 in the Family Element.
162
165
  # * <code>element.locate("Family/?/@age")</code> returns the arg attribute for each child in the Family Element.
163
166
  # * <code>element.locate("Family/*/@type")</code> returns the type attribute value for decendents of the Family.
164
167
  # * <code>element.locate("Family/^Comment")</code> returns any comments that are a child of Family.
@@ -283,8 +286,12 @@ module Ox
283
286
  when '>'
284
287
  match = index <= match.size ? match[index + 1..-1] : []
285
288
  when '@'
286
- k,v = step[3..-2].split('=')
287
- match = match.select { |n| n.is_a?(Element) && (v == n.attributes[k.to_sym] || v == n.attributes[k]) }
289
+ k,v = step[i..-2].split('=')
290
+ if v
291
+ match = match.select { |n| n.is_a?(Element) && (v == n.attributes[k.to_sym] || v == n.attributes[k]) }
292
+ else
293
+ match = match.select { |n| n.is_a?(Element) && (n.attributes[k.to_sym] || n.attributes[k]) }
294
+ end
288
295
  else
289
296
  raise InvalidPath.new(path)
290
297
  end
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.9.1'
4
+ VERSION = '2.9.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-14 00:00:00.000000000 Z
11
+ date: 2018-04-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "A fast XML parser and object serializer that uses only standard C lib.\n
14
14
  \ \nOptimized XML (Ox), as the name implies was written to provide speed