Handle boolean values in predicate results.

This commit is contained in:
Yorick Peterse 2014-08-27 20:26:10 +02:00
parent 7c41fa814f
commit 10e82de87b
1 changed files with 7 additions and 2 deletions

View File

@ -161,8 +161,13 @@ module Oga
if retval.is_a?(Numeric) if retval.is_a?(Numeric)
new_nodes << current if retval.to_i == xpath_index new_nodes << current if retval.to_i == xpath_index
# Node sets, strings, etc # Node sets, strings, booleans, etc
elsif retval and !retval.empty? elsif retval
# Empty strings and node sets evaluate to false.
if retval.respond_to?(:empty?) and retval.empty?
next
end
new_nodes << current new_nodes << current
end end
end end