Google

"DTD/xhtml1-strict.dtd">
Module MIME::Types
In: MIME/types.rb

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).

Copyright:Copyright (c) 2002 by Austin Ziegler
Version:1.004
Based On:Perl MIME::Types, Copyright (c) 2001-2002 by Jeff Okamoto and Mark Overmeer.
Licence:Ruby's, Perl Artistic, or GPL version 2 (or later)
See Also:ftp.isi.edu/in-notes/iana/assignments/media-types/media-types www.indiana.edu/cgi-bin-local/mimetypes
Methods
[]    add    of    type_for   
Public Class methods
[](type_string)

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?

  }

type_for(filename)

Return the MIME::Type which belongs to the file based on its filename extension.



  puts "MIME::Types.type_for('citydesk.gif') => "              #        "#{MIME::Types.type_for('citydesk.gif')}"

of(filename)

A synonym for MIME::Types.type_for

add(*types)

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.