hpricot:An Hpricot Showcase:Hpricot Challenge:Finding the element with the largest attribute

まんま

>> require "hpricot"
=> true
>> doc = Hpricot('<image height="300">x</image><image hieght="200">y</image>')
=> #<Hpricot::Doc {elem <image height="300"> "x" </image>} {elem <image hieght="200"> "y" </image>}>
>> (doc / 'image').sort_by {|img| img['height'].to_i}[-1]
=> {elem <image height="300"> "x" </image>}