提交 152bd3c5 编写于 作者: X Xavier Noria

Revert "Used any? instead of length call"

Reason: This is slower, and any? is not equivalent in the
general case.

See discussion in https://github.com/rails/rails/pull/3779

This reverts commit 20cbf8ed.
上级 ad5c8b0d
......@@ -70,7 +70,7 @@ def collapse(element)
hash = get_attributes(element)
child_nodes = element.child_nodes
if child_nodes.any?
if child_nodes.length > 0
for i in 0...child_nodes.length
child = child_nodes.item(i)
merge_element!(hash, child) unless child.node_type == Node.TEXT_NODE
......
......@@ -26,7 +26,7 @@ def parse(data)
else
data.ungetc(char)
doc = Nokogiri::XML(data)
raise doc.errors.first if doc.errors.any?
raise doc.errors.first if doc.errors.length > 0
doc.to_hash
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册