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 ...
while element.class != Hpricot::Doc do
element = element.parent
i.e. in the first snippet I am pushing element’s names, and in the
latter the elements themselves.