364: def initialize(content_type)
365: matchdata = MEDIA_TYPE_RE.match(content_type)
366:
367: if matchdata.nil?
368: raise InvalidContentType, "Invalid Content-Type provided ('#{content_type}')"
369: end
370:
371: @content_type = content_type
372: @raw_media_type = matchdata.captures[0]
373: @raw_sub_type = matchdata.captures[1]
374:
375: @simplified = MIME::Type.simplified(@content_type)
376: matchdata = MEDIA_TYPE_RE.match(@simplified)
377: @media_type = matchdata.captures[0]
378: @sub_type = matchdata.captures[1]
379:
380: self.extensions = nil
381: self.encoding = :default
382: self.system = nil
383: self.registered = true
384:
385: yield self if block_given?
386: end