Introduction
MIME::Types provides the ability for detailed
information about MIME entities to be determined and used programmatically.
This is based on Perl MIME::Types 1.004 and
reflects this heritage in the existence of both MIME::Types and MIME::Type
(which is the definition of a single MIME type). As with the Perl version,
this module is built to conform with MIME types in RFC 2045 and 2231. This
library follows the collection of MIME types at the USC Information
Sciences Institute (see below for reference).
Return the MIME::Type which describes the type
related to the provided string or regular expression. If a string is
provided, it must match exactly, or nil will be returned.
It is possible for multiple matches to be returned for either type (in the
example below, 'text/plain' returns two values -- one for the general case,
and one for VMS systems. Do not assume a single MIME::Type will be returned.
puts "\nMIME::Types['text/plain']"
MIME::Types['text/plain'].each { |t| puts mt_flags(t) }
puts "\nMIME::Types[/^image/] (block filters for extensions)"
MIME::Types[/^image/].each { |t|
puts mt_flags(t) unless t.extensions.empty?
}
Return the MIME::Type which belongs to the file
based on its filename extension.
puts "MIME::Types.type_for('citydesk.xml') => " # "#{MIME::Types.type_for('citydesk.xml')}"
puts "MIME::Types.type_for('citydesk.gif') => " # "#{MIME::Types.type_for('citydesk.gif')}"
Add one or more MIME::Type objects to the set of
known types. Each type should be experimental.
Please inform the maintainer of this module when registered types are
missing.