Class File
In: lib/rdig/file.rb
Parent: Object

Extend class File with a content_type method

Methods

Constants

FILE_EXTENSION_MIME_TYPES = { 'doc' => 'application/msword', 'html' => 'text/html', 'htm' => 'text/html', #'.odt' => 'application/vnd.oasis.opendocument.text', 'pdf' => 'application/pdf', 'txt' => 'text/plain', }   mime types and file extensions

Public Instance methods

[Source]

    # File lib/rdig/file.rb, line 14
14:   def content_type
15:     FILE_EXTENSION_MIME_TYPES[File.extname(self.path).downcase.gsub(/^\./,'')] || 'application/octet-stream'
16:   end

[Validate]