diff --git a/lib/nokogiri/xml/reader.rb b/lib/nokogiri/xml/reader.rb index 49755d8ab6..2b545f5047 100644 --- a/lib/nokogiri/xml/reader.rb +++ b/lib/nokogiri/xml/reader.rb @@ -101,10 +101,10 @@ def attribute_nodes end ### - # Move the cursor through the document yielding each node to the block - def each(&block) - while node = self.read - block.call(node) + # Move the cursor through the document yielding the cursor to the block + def each + while cursor = self.read + yield cursor end end end