Sha256: 8d57d7ae81d276273a3ca62447864b1c90aced20aa43acf9d33590b94f6254de

Contents?: true

Size: 648 Bytes

Versions: 4

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

require "simple_text_extract/version"
require "simple_text_extract/extract"

module SimpleTextExtract
  SUPPORTED_FILETYPES = ["xls", "xlsx", "doc", "docx", "txt", "pdf", "csv", "zip"].freeze

  class Error < StandardError; end

  def self.extract(filename: nil, raw: nil, filepath: nil, tempfile: nil)
    Extract.new(filename:, raw:, filepath:, tempfile:).to_s
  end

  def self.supports?(filename: nil)
    SUPPORTED_FILETYPES.include?(filename.to_s.split(".").last)
  end

  def self.missing_dependency?(command)
    dependency = `sh -c 'command -v #{command}'`
    dependency.nil? || dependency.empty?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_text_extract-3.0.8 lib/simple_text_extract.rb
simple_text_extract-3.0.7 lib/simple_text_extract.rb
simple_text_extract-3.0.6 lib/simple_text_extract.rb
simple_text_extract-3.0.5 lib/simple_text_extract.rb