Class: Pancake::MimeTypes::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/pancake/mime_types.rb

Overview

A basic type for mime types Each type can have an extension and many type strings that correspond to the mime type that would be specified in a request When a Pancake::MimeTypes::Type is created, it is added to the Pancake::MimeTypes.types collection

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(extension, *type_strings) ⇒ Type

Returns a new instance of Type.



267
268
269
270
271
272
273
274
# File 'lib/pancake/mime_types.rb', line 267

def initialize(extension, *type_strings)
  @extension = extension
  @type_strings = []
  type_strings.flatten.each do |ts|
    @type_strings << ts
  end
  MimeTypes.types << self
end

Instance Attribute Details

#extensionObject (readonly)



265
266
267
# File 'lib/pancake/mime_types.rb', line 265

def extension
  @extension
end

#type_stringsObject (readonly)



265
266
267
# File 'lib/pancake/mime_types.rb', line 265

def type_strings
  @type_strings
end