Hello,

I have two very similar code snippets in two different methods, and I am 
absolutely sure there is some nice way to DRY them in Ruby... I am still 
a noob when comes to Ruby idioms so I'd appreciate some help ;-)

     ...
     while element.class != Hpricot::Doc do
         path.push element.name
         element = element.parent
     end
     ...

and
     ...
     while element.class != Hpricot::Doc do
         path.push element
         element = element.parent
     end
     ...


i.e. in the first snippet I am pushing element's names, and in the 
latter the elements themselves.

Thanks,
Peter
http://www.rubyrailways.com