561: def [](type_id, flags = {})
562: if type_id.kind_of?(Regexp)
563: matches = []
564: @type_variants.each_key do |k|
565: matches << @type_variants[k] if k =~ type_id
566: end
567: matches.flatten!
568: elsif type_id.kind_of?(MIME::Type)
569: matches = [type_id]
570: else
571: matches = @type_variants[MIME::Type.simplified(type_id)]
572: end
573:
574: matches.delete_if { |e| not e.complete? } if flags[:complete]
575: matches.delete_if { |e| not e.platform? } if flags[:platform]
576: matches
577: end