Method: MIME::Type.simplified

Defined in:
lib/mime/type.rb

.simplified(content_type) ⇒ Object

The MIME types main- and sub-label can both start with x-, which indicates that it is a non-registered name. Of course, after registration this flag can disappear, adds to the confusing proliferation of MIME types. The simplified string has the x- removed and are translated to lowercase.



553
554
555
556
557
558
559
560
561
562
563
# File 'lib/mime/type.rb', line 553

def simplified(content_type)
  matchdata = MEDIA_TYPE_RE.match(content_type)

  if matchdata.nil?
    nil
  else
    matchdata.captures.map { |e|
      e.downcase.gsub(UNREGISTERED_RE, '')
    }.join('/')
  end
end