Permalink
Browse files

Merge pull request #3779 from rahul100885/rahul100885_work

Used any? instead of length call
  • Loading branch information...
2 parents b00cf12 + 20cbf8e commit 5cf56a4e7711b952d86d5c9c563bd05d2313883b @josevalim josevalim committed Nov 28, 2011
@@ -70,7 +70,7 @@ def collapse(element)
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
@@ -26,7 +26,7 @@ def parse(data)
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

0 comments on commit 5cf56a4

Please sign in to comment.