Permalink
Browse files

Used any? instead of length call

  • Loading branch information...
rahul100885 committed Nov 28, 2011
1 parent b00cf12 commit 20cbf8eddc3844126d20f1218f068889d17b0dcf
@@ -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 20cbf8e

Please sign in to comment.