Sha256: 6effa2a3114217f97ea8460a69778858136aec8c41f881267fe3d41a1d60981d

Contents?: true

Size: 645 Bytes

Versions: 2

Compression:

Stored size: 645 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.split(".").last)
  end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_text_extract-3.0.1 lib/simple_text_extract.rb
simple_text_extract-3.0.0 lib/simple_text_extract.rb