mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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 20cbf8eddc
.
This commit is contained in:
parent
ad5c8b0d52
commit
152bd3c510
2 changed files with 2 additions and 2 deletions
|
@ -70,7 +70,7 @@ module ActiveSupport
|
|||
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 @@ module ActiveSupport
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue