rexle 0.9.30 → 0.9.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rexle.rb +8 -4
  2. metadata +2 -2
@@ -10,6 +10,7 @@ require 'cgi'
10
10
  include REXML
11
11
 
12
12
  # modifications:
13
+ # 19-Jun-2012: a bug fix for .//*[@class]
13
14
  # 17-Jun-2012: a couple of new xpath things are supported '.' and '|'
14
15
  # 15-Apr-2012: bug fix: New element names are typecast as string
15
16
  # 16-Mar-2012: bug fix: Element names which contain a colon can now be selected
@@ -175,7 +176,8 @@ class Rexle
175
176
  end
176
177
 
177
178
  def xpath(path, rlist=[], &blk)
178
- filter_xpath(path, rlist=[], &blk)
179
+ r = filter_xpath(path, rlist=[], &blk)
180
+ r.is_a?(Array) ? r.compact : r
179
181
  end
180
182
 
181
183
  def filter_xpath(path, rlist=[], &blk)
@@ -194,9 +196,8 @@ class Rexle
194
196
  }
195
197
  bucket = []
196
198
  raw_results = path.split('|').map do |xp|
197
- r3 = query_xpath(xp, bucket, &blk)
198
- r3
199
- end
199
+ query_xpath(xp, bucket, &blk)
200
+ end
200
201
 
201
202
  #results = raw_results.inject(&:+)
202
203
  results = raw_results.last
@@ -529,7 +530,10 @@ class Rexle
529
530
 
530
531
  r = []
531
532
  xpath2 = path[2..-1]
533
+ xpath2.sub!(/^\*\//,'')
534
+ xpath2.sub!(/^\*/,self.name)
532
535
  xpath2.sub!(/^\w+/,'').sub!(/^\//,'') if xpath2[/^\w+/] == self.name
536
+
533
537
 
534
538
  r << node.xpath(xpath2)
535
539
  r << node.children.map {|n| scan_match(n, path) if n.is_a? Rexle::Element}
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.30
5
+ version: 0.9.31
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Robertson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-18 00:00:00 Z
13
+ date: 2012-06-19 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rexleparser