Module: Clarity::Mime

Defined in:
lib/clarity/server/mime_types.rb

Constant Summary collapse

TYPES =
{
  '.jpg'    =>  'image/jpg', 
  '.jpeg'   =>  'image/jpeg',
  '.gif'    =>  'image/gif', 
  '.png'    =>  'image/png',
  '.bmp'    =>  'image/bmp',
  '.bitmap' =>  'image/x-ms-bmp',
  '.js'     => 'application/javascript',
  '.txt'    => 'text/plain',
  '.css'    => 'text/css',
  '.html'   => 'text/html',
  '.htm'    => 'text/html'
}

Class Method Summary collapse

Class Method Details

.for(filename) ⇒ Object



3
4
5
6
7
# File 'lib/clarity/server/mime_types.rb', line 3

def self.for(filename)
  
  content_type = TYPES[File.extname(filename)] 
  content_type || 'text/plain'
end