lib/wants/mimeparse.rb
def parse_media_range(range)
    type, subtype, params = parse_mime_type(range)
    unless params.has_key?("q") and params["q"] and params["q"].to_f and params["q"].to_f <= 1 and params["q"].to_f >= 0
      params["q"] = "1"
    end

    [type, subtype, params]
  end
def parse_media_range(range)
    type, subtype, params = parse_mime_type(range)
    unless params.has_key?("q") and params["q"] and params["q"].to_f and params["q"].to_f <= 1 and params["q"].to_f >= 0
      params["q"] = "1"
    end

    [type, subtype, params]
  end
Carves up a media range 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/*;q=0.5" would
  get parsed into:

 ["application", "*", { "q", "0.5" }]

 In addition this function also guarantees that there
  is a value for "q" in the params dictionary, filling it
  in with a proper default if necessary.