From: Gavin Kistner Date: 2005-10-19T22:13:14+09:00 Subject: Re: Unit Testing with REXML questions On Oct 16, 2005, at 9:07 AM, Jeff Wood wrote: > count = 0 ; xml.elements( '/a/d' ).each { count += 1 ) ; puts count Because the each method returns the collection, you can actually just do this (odd-looking) hack: puts xml.elements.each('/a/d'){}.size (The block is required, but may be empty.)