1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Used any? instead of length call

This commit is contained in:
Rahul P. Chaudhari 2011-11-28 12:05:39 +05:30
parent b00cf122e2
commit 20cbf8eddc
2 changed files with 2 additions and 2 deletions

View file

@ -70,7 +70,7 @@ module ActiveSupport
hash = get_attributes(element)
child_nodes = element.child_nodes
if child_nodes.length > 0
if child_nodes.any?
for i in 0...child_nodes.length
child = child_nodes.item(i)
merge_element!(hash, child) unless child.node_type == Node.TEXT_NODE

View file

@ -26,7 +26,7 @@ module ActiveSupport
else
data.ungetc(char)
doc = Nokogiri::XML(data)
raise doc.errors.first if doc.errors.length > 0
raise doc.errors.first if doc.errors.any?
doc.to_hash
end
end