class Nokogiri::XML::NodeSet

def attr key, value = nil, &blk

on all Node objects in the NodeSet.
Set the attribute +key+ to +value+ or the return value of +blk+
##
def attr key, value = nil, &blk
  if value or blk
    each do |el|
      el.set_attribute(key, value || blk[el])
    end
    return self
  end
  if key.is_a? Hash
    key.each { |k,v| self.attr(k,v) }
    return self
  else
    return self[0].get_attribute(key)
  end
end