Class: Textractor::ContentTypeDetector::Simple

Inherits:
Object
  • Object
show all
Defined in:
lib/textractor/content_type_detector/simple.rb

Class Method Summary collapse

Class Method Details

.content_type_for_path(path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/textractor/content_type_detector/simple.rb', line 5

def self.content_type_for_path(path)
  case File.extname(path.downcase)
  when /\.pdf$/
    'application/pdf'
  when /\.doc$/
    'application/msword'
  when /\.docx$/
    'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  when /\.txt$/
    'text/plain'
  end
end