Sha256: 131d7880ef4836bc9913b17ef89de69386562a88f68ba1df4c1b65a542c6f4ab

Contents?: true

Size: 528 Bytes

Versions: 7

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module SimpleTextExtract
  class TextExtractor
    def self.call(filename: nil, raw: nil, filepath: nil)
      if !filename.nil? && !raw.nil?
        TempfileExtractor.new(filename: filename.to_s, raw: raw).extract
      elsif !filepath.nil? && File.exist?(filepath)
        FileExtractor.new(filepath: filepath).extract
      end
    end

    def extract
      text = FormatExtractorFactory.call(file).extract
      cleanup

      text
    end

    private

      def cleanup
      end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_text_extract-0.3.0 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.2.1 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.2.0 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.1.3 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.1.2 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.1.1 lib/simple_text_extract/text_extractor.rb
simple_text_extract-0.1.0 lib/simple_text_extract/text_extractor.rb