rexle 0.9.41 → 0.9.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/rexle.rb +3 -3
  2. metadata +2 -2
data/lib/rexle.rb CHANGED
@@ -10,6 +10,7 @@ require 'cgi'
10
10
  include REXML
11
11
 
12
12
  # modifications:
13
+ # 13-Aug-2012: bug fix: xpath can now handle the name() function
13
14
  # 11-Aug-2012: bug fix: separated the max() method from 1 line into 3
14
15
  # and that fixed it
15
16
  # 08-Aug-2012: feature: added Element#insert_before and Element#insert_after
@@ -174,7 +175,6 @@ class Rexle
174
175
  end
175
176
 
176
177
  def name()
177
-
178
178
  if @rexle then
179
179
  prefix = @rexle.prefixes.find {|x| x == @name[/^(\w+):/,1] } if @rexle.prefixes.is_a? Array
180
180
  prefix ? @name.sub(prefix + ':', '') : @name
@@ -191,7 +191,7 @@ class Rexle
191
191
  def filter_xpath(path, rlist=[], &blk)
192
192
 
193
193
  # is it a function
194
- fn_match = path.match(/^(\w+)\(([^\)]+)\)$/)
194
+ fn_match = path.match(/^(\w+)\(([^\)]*)\)$/)
195
195
 
196
196
  # Array: proc {|x| x.flatten.compact},
197
197
  if (fn_match and fn_match.captures.first[/^(attribute|@)/]) or fn_match.nil? then
@@ -213,7 +213,7 @@ class Rexle
213
213
 
214
214
  else
215
215
  m, xpath_value = fn_match.captures
216
- method(m.to_sym).call(xpath_value)
216
+ xpath_value.empty? ? method(m.to_sym).call : method(m.to_sym).call(xpath_value)
217
217
  end
218
218
 
219
219
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.41
5
+ version: 0.9.42
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-08-11 00:00:00 Z
13
+ date: 2012-08-13 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rexleparser