# File lib/mime/types.rb, line 637 def [](type_id, flags = {}) if type_id.kind_of?(Regexp) matches = [] @type_variants.each_key do |k| matches << @type_variants[k] if k =~ type_id end matches.flatten! elsif type_id.kind_of?(MIME::Type) matches = [type_id] else matches = @type_variants[MIME::Type.simplified(type_id)] end matches.delete_if { |e| not e.complete? } if flags[:complete] matches.delete_if { |e| not e.platform? } if flags[:platform] matches.sort { |a, b| a.priority_compare(b) } end