lib/wants/mimeparse.rb
def parse_mime_type(mime_type)
    parts = mime_type.split(";")

    params = {}

    parts[1..-1].map do |param|
      k,v = param.split("=").map { |s| s.strip }
      params[k] = v
    end

    full_type = parts[0].strip
    # Java URLConnection class sends an Accept header that includes a single "*"
    # Turn it into a legal wildcard.
    full_type = "*/*" if full_type == "*"
    type, subtype = full_type.split("/")
    raise "malformed mime type" unless subtype

    [type.strip, subtype.strip, params]
  end
def parse_mime_type(mime_type)
    parts = mime_type.split(";")

    params = {}

    parts[1..-1].map do |param|
      k,v = param.split("=").map { |s| s.strip }
      params[k] = v
    end

    full_type = parts[0].strip
    # Java URLConnection class sends an Accept header that includes a single "*"
    # Turn it into a legal wildcard.
    full_type = "*/*" if full_type == "*"
    type, subtype = full_type.split("/")
    raise "malformed mime type" unless subtype

    [type.strip, subtype.strip, params]
  end
Carves up a mime-type and returns an Array of the
  [type, subtype, params] where "params" is a Hash of all
  the parameters for the media range.

 For example, the media range "application/xhtml;q=0.5" would
  get parsed into:

 ["application", "xhtml", { "q" => "0.5" }]