Parent

HTTP::MimeType

Yes, HTTP bundles its own MIME type library. Maybe it should be spun off as a separate gem or something.

Attributes

shortcut[R]
type[R]

Public Class Methods

[](type) click to toggle source
# File lib/http/mime_type.rb, line 13
def [](type)
  if type.is_a? Symbol
    @shortcuts[type]
  else
    @mime_types[type]
  end
end
new(type, shortcut = nil) click to toggle source
# File lib/http/mime_type.rb, line 24
def initialize(type, shortcut = nil)
  @type, @shortcut = type, shortcut
  @parse_with = @emit_with = nil

  self.class.register self
end
register(obj) click to toggle source
# File lib/http/mime_type.rb, line 8
def register(obj)
  @mime_types[obj.type] = obj
  @shortcuts[obj.shortcut] = obj if obj.shortcut
end

Public Instance Methods

emit(obj) click to toggle source
# File lib/http/mime_type.rb, line 44
def emit(obj)
  @emit_with  ? @emit_with[obj]  : obj
end
emit_with(&block) click to toggle source
# File lib/http/mime_type.rb, line 36
def emit_with(&block)
  @emit_with = block
end
parse(obj) click to toggle source
# File lib/http/mime_type.rb, line 40
def parse(obj)
  @parse_with ? @parse_with[obj] : obj
end
parse_with(&block) click to toggle source

Define

# File lib/http/mime_type.rb, line 32
def parse_with(&block)
  @parse_with = block
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.