def all_avps_by_code(code, vendor = 0)
      @avps.select do |a|
        vendor_match =
          if a.vendor_specific?
            a.vendor_id == vendor
          else
            vendor == 0
          end
        (a.code == code) && vendor_match
      end
    end
def all_avps_by_code(code, vendor = 0)
      @avps.select do |a|
        vendor_match =
          if a.vendor_specific?
            a.vendor_id == vendor
          else
            vendor == 0
          end
        (a.code == code) && vendor_match
      end
    end
@private
 Prefer AVP.define and the by-name versions to this

 Returns all AVPs with the given code and vendor. Only covers "top-level"
 AVPs - it won't look inside Grouped AVPs.

 @param code [Fixnum] The AVP Code
 @param vendor [Fixnum] Optional vendor ID for a vendor-specific
   AVP.
 @return [Array<AVP>]