rexle 1.0.6 → 1.0.7

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: 0cdf49bdef3b0fb65c72164bf026ddba35b008b3
4
- data.tar.gz: 53502d610baf33519c897b60e6c128ebf583735e
3
+ metadata.gz: f2b3a9a4677cb65f6163a779451d74b13d7abb51
4
+ data.tar.gz: 1816dfc0ab8762ec36a1c1d80d1bac522796516b
5
5
  SHA512:
6
- metadata.gz: d4cffb4c3c588b55952bfca1acfa30828b765d9339f81ac1fa0d9a6d3fe06deaa3fb299708b64d827fa63fce2f8290a2658a16a467bfabe34d1804e5a85ba305
7
- data.tar.gz: a4650d5ecbbac99f24d8e8109056ab0c92a2fa10081d5de8297e9d07f155bf675be76896c6dd5cb0b338aaefea4885c5ba9a7a496980e431cfecd2c16d12cfac
6
+ metadata.gz: f40c7c191e9496203c8e59bc016623150a286b44e9c4e9155973ddc57580e0f5950fab15added496f32d7a397c51937725bf716c5655853e4cc5881d845cd8d0
7
+ data.tar.gz: f13f2e162930d0c36121c4310920dd477835263a11731827c65e644d385a3f07833eb17af651b7864b2554df17d2f856bf74264d932432ae07ef8869a22af7ce
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -11,6 +11,8 @@ include REXML
11
11
 
12
12
  # modifications:
13
13
 
14
+ # 20-May-2014: feature: XPath Descendants after the element (or without
15
+ # the element) are now supported
14
16
  # 02-Apr-2014: bug fix: Rexle::Element#each now returns the children,
15
17
  # including the 1st text element
16
18
  # 24-Mar-2014: minor bug fix: A blank line is no longer inserted at the
@@ -278,6 +280,7 @@ class Rexle
278
280
  end
279
281
 
280
282
  def xpath(path, rlist=[], &blk)
283
+
281
284
  r = filter_xpath(path, rlist=[], &blk)
282
285
  r.is_a?(Array) ? r.compact : r
283
286
  end
@@ -345,7 +348,7 @@ class Rexle
345
348
  .match(/([^\[]+)(\[[^\]]+\])?/).captures
346
349
 
347
350
  remaining_path = ($').to_s
348
-
351
+
349
352
  r = raw_path[/([^\/]+)(?=\/\/)/,1]
350
353
  if r then
351
354
  a_path = raw_path.split(/(?=\/\/)/,2)
@@ -412,7 +415,7 @@ class Rexle
412
415
  regex = /\[(\d+)\]$/
413
416
  n = xpath_value[regex,1]
414
417
  xpath_value.slice!(regex)
415
-
418
+
416
419
  rs = scan_match(self, xpath_value).flatten.compact
417
420
  return n ? rs[n.to_i-1] : rs
418
421
 
@@ -754,6 +757,11 @@ class Rexle
754
757
 
755
758
  def scan_match(node, path)
756
759
 
760
+ if path == '//' then
761
+ return [node, !node.text.empty? ? node.text : nil,
762
+ node.elements.map {|x| scan_match x, path}]
763
+ end
764
+
757
765
  r = []
758
766
  xpath2 = path[2..-1]
759
767
  xpath2.sub!(/^\*\//,'')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  UOGKUMV5RApHDnC0ywMYNe0HK7qMSTP5YLKs8JUjNxpc5jl8+o3D3sHkNN4DzbQm
32
32
  jVfzDZ+niKvAUA==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-04-02 00:00:00.000000000 Z
34
+ date: 2014-05-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.0.14
119
+ rubygems_version: 2.1.11
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Rexle is a simple XML parser written purely in Ruby
metadata.gz.sig CHANGED
Binary file