def each_priority(records)
      pri_hash = records.inject({}) do |groups, element|
        groups[element.priority] ||= []
        groups[element.priority] << element
        groups
      end

      pri_hash.keys.sort.each do |key|
        yield pri_hash[key]
      end
    end
def each_priority(records)
      pri_hash = records.inject({}) do |groups, element|
        groups[element.priority] ||= []
        groups[element.priority] << element
        groups
      end

      pri_hash.keys.sort.each do |key|
        yield pri_hash[key]
      end
    end
Groups the records by their priority and yields the groups
 in order of highest to lowest priority (lowest to highest numbers),
 one at a time.
 { 1 => [records], 2 => [records], etc. }

 @param [[Resolv::DNS::Resource::IN::SRV]] records the list of
        records for a given service
 @yields [[Resolv::DNS::Resource::IN::SRV]] a group of records of
         the same priority