A Format Manager. Provides useful methods for fast Format lookup.

Methods
Attributes
[RW] by_extension Formats indexed by extension.
[RW] by_mime_type Formats indexed by mime type.
[RW] by_name Formats indexed by name.
Public Class methods
new(*formats)
    # File lib/raw/dispatcher/format.rb, line 67
67:   def initialize(*formats)
68:     @by_name = {}
69:     @by_mime_type = {}
70:     @by_extension = {}
71:     
72:     for format in formats.flatten
73:       put(format)
74:     end
75:   end
Public Instance methods
<<(format)

Alias for #put

[](name)

Lookup a format by name.

    # File lib/raw/dispatcher/format.rb, line 92
92:   def [](name)
93:     @by_name[name]
94:   end
put(format)

Add a new format to the manager.

This method is also aliased as <<
    # File lib/raw/dispatcher/format.rb, line 79
79:   def put(format)
80:     if format.is_a? Class
81:       format = format.new
82:     end
83:     
84:     @by_name[format.name] = format          
85:     @by_mime_type[format.mime_type] = format          
86:     @by_extension[format.extension] = format          
87:   end