diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-03 15:51:08 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-04-03 15:51:08 +0000 |
commit | c592ce4023fdd6877aeeb38dfbbf54790dea238f (patch) | |
tree | 6db84955af09af6ba4f30bc4ef5b2392bf26c828 /lib/rexml/functions.rb | |
parent | a03e6e5e28b46ebe6e4705aeb2b631e258693bef (diff) | |
download | ruby-c592ce4023fdd6877aeeb38dfbbf54790dea238f.tar.gz |
rexml: Fix a XPath bug of name(node-set)
[Bug #14600]
* lib/rexml/functions.rb: Fix a bug that "name(node-set)" returns
element instead of element name.
* test/rexml/test_jaxen.rb: Enable more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/functions.rb')
-rw-r--r-- | lib/rexml/functions.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index cd879fdd28..b84209619d 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -86,10 +86,14 @@ module REXML # Helper method. def Functions::get_namespace( node_set = nil ) if node_set == nil - yield @@context[:node] if defined? @@context[:node].namespace + yield @@context[:node] if @@context[:node].respond_to?(:namespace) else if node_set.respond_to? :each - node_set.each { |node| yield node if defined? node.namespace } + result = [] + node_set.each do |node| + result << yield(node) if node.respond_to?(:namespace) + end + result elsif node_set.respond_to? :namespace yield node_set end |