class SimpleTextExtract::FormatExtractorFactory

Public Class Methods

call(file) click to toggle source
# File lib/simple_text_extract/format_extractor_factory.rb, line 14
def self.call(file)
  case file.path
  when /.zip$/i
    FormatExtractor::ZipExtract.new(file)
  when /(.txt$|.csv$)/i
    FormatExtractor::PlainText.new(file)
  when /.pdf$/i
    FormatExtractor::PDF.new(file)
  when /.docx$/i
    FormatExtractor::DocX.new(file)
  when /.doc$/i
    FormatExtractor::Doc.new(file)
  when /.xlsx$/i
    FormatExtractor::XlsX.new(file)
  when /.xls$/i
    FormatExtractor::Xls.new(file)
  else
    FormatExtractor::Base.new(file)
  end
end