Module: Bookbinder::MediaType

Defined in:
lib/bookbinder/media_type.rb

Constant Summary collapse

MEDIA_TYPES =
{
  '.ncx' => 'application/x-dtbncx+xml',
  '.opf' => 'application/oebps-package+xml',
  '.smil' => 'application/smil+xml'
}

Class Method Summary collapse

Class Method Details

.of(path) ⇒ Object



12
13
14
15
# File 'lib/bookbinder/media_type.rb', line 12

def self.of(path)
  ext = File.extname(path)
  MEDIA_TYPES[ext] || MIME::Types.of(ext).first.to_s || 'text/plain'
end