rexle 1.0.17 → 1.0.18

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: 5d0cd773f30476b44a8f3efca774d605dce5d4e8
4
- data.tar.gz: f70f550783380e1110135310ff6da3888a4dbc5c
3
+ metadata.gz: 263aade38f51977874dcd017bc8639d475c02dd5
4
+ data.tar.gz: bf4857e694d9ebb017bbb90f3a9ac2b0758f0f0b
5
5
  SHA512:
6
- metadata.gz: e73b58669324eb634853d98da2fd6d7441d0dd1936c823f62f4b4fe621c1586f14d3f58994c2df6f813ac570c7c9f89173736a9c2b442c3b0c3b67670e1ba603
7
- data.tar.gz: 67c3c47d64f818463a2c5998bb38b23b9cf742ab430cd8b40ef04472497ac1ac1043b69d035751c4e8c5eeefbbdfb60a167ed8e7330c70e6a181f67915aee556
6
+ metadata.gz: 7df7c15a944ce8a73bce3f60abde5fecfd854fd4b2fac74e4e77a34fa9c5ac20e1b376f437f685a95400cf75917853deb320f964d91608bba2c7d3c1c41441ec
7
+ data.tar.gz: 026a933cf664b37bc1a984156aafc36861edcac8cd451a321446da54523cc0aa56e4e069f53bf7c1d699c6b4634f4059de1bb266f0c0cd2a0a848db5a33dca62
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rexle.rb CHANGED
@@ -11,7 +11,7 @@ include REXML
11
11
 
12
12
  # modifications:
13
13
 
14
- # 14-Jun-2014: bug fix: Processing instructions should now display properly
14
+ # 12-Jul-2014: XPath with a single element condition now works e.g. b[c]
15
15
  # 07-Jun-2014: bug fix: An XPath nested within an XPath (using a selector)
16
16
  # should now wok properly e.g. record/abc[item/xyz="red"]
17
17
  # 04-Jun-2014: bug fix: If XPath contains /text(), only valid
@@ -309,6 +309,7 @@ class Rexle
309
309
 
310
310
  # Array: proc {|x| x.flatten.compact},
311
311
  if (fn_match and fn_match.captures.first[/^(attribute|@)/]) or fn_match.nil? then
312
+
312
313
  procs = {
313
314
  #jr061012 Array: proc {|x| block_given? ? x : x.flatten.uniq },
314
315
  Array: proc { |x|
@@ -335,6 +336,7 @@ class Rexle
335
336
  procs[results.class.to_s.to_sym].call(results) if results
336
337
 
337
338
  else
339
+
338
340
  m, xpath_value = fn_match.captures
339
341
  xpath_value.empty? ? method(m.to_sym).call : method(m.to_sym).call(xpath_value)
340
342
  end
@@ -452,7 +454,7 @@ class Rexle
452
454
 
453
455
  if (a_path + [remaining_path]).join.empty? then
454
456
 
455
- rlist = return_elements.map.with_index {|x,i| filter(x, i+1, attr_search, &blk)}.compact
457
+ rlist = return_elements.map.with_index {|x,i| filter(x, i+1, attr_search, &blk)}.compact
456
458
  rlist = rlist[0] if rlist.length == 1
457
459
 
458
460
  else
@@ -822,6 +824,7 @@ class Rexle
822
824
  h = x[0][1] # <-- fetch the attributes
823
825
 
824
826
  if attr_search then
827
+
825
828
  attribute_search(attr_search,e, h, i, &blk)
826
829
  else
827
830
 
@@ -832,8 +835,6 @@ class Rexle
832
835
 
833
836
  def attribute_search(attr_search, e, h, i=nil, &blk)
834
837
 
835
- r2 = e.xpath('records/dependency/summary/title')
836
-
837
838
  if attr_search.is_a? Fixnum then
838
839
  block_given? ? blk.call(e) : e if i == attr_search
839
840
  elsif attr_search[/i\s[<>\=]\s\d+/] and eval(attr_search) then
@@ -854,6 +855,8 @@ class Rexle
854
855
  end
855
856
  elsif attr_search[/e\.xpath/] and eval(attr_search)
856
857
  block_given? ? blk.call(e) : e
858
+ elsif e.element attr_search then
859
+ block_given? ? blk.call(e) : e
857
860
  end
858
861
  end
859
862
  end # -- end of element --
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.17
4
+ version: 1.0.18
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-06-14 00:00:00.000000000 Z
34
+ date: 2014-07-11 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rexleparser
@@ -145,3 +145,4 @@ signing_key:
145
145
  specification_version: 4
146
146
  summary: Rexle is a simple XML parser written purely in Ruby
147
147
  test_files: []
148
+ has_rdoc:
metadata.gz.sig CHANGED
Binary file