Class: ChupaText::Decomposers::LibreOfficeGeneral

Inherits:
Decomposer
  • Object
show all
Includes:
Loggable
Defined in:
lib/chupa-text/decomposers/libreoffice-general.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ LibreOfficeGeneral

Returns a new instance of LibreOfficeGeneral.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/chupa-text/decomposers/libreoffice-general.rb', line 25

def initialize(options)
  super
  @command = find_command
  debug do
    if @command
      "#{log_tag}[command][found] #{@command.path}"
    else
      "#{log_tag}[command][not-found]"
    end
  end
end

Instance Method Details

#decompose(data) {|pdf_data| ... } ⇒ Object

Yields:

  • (pdf_data)


43
44
45
46
47
# File 'lib/chupa-text/decomposers/libreoffice-general.rb', line 43

def decompose(data)
  pdf_data = convert_to_pdf(data)
  return if pdf_data.nil?
  yield(pdf_data)
end

#target?(data) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
41
# File 'lib/chupa-text/decomposers/libreoffice-general.rb', line 37

def target?(data)
  return false if @command.nil?
  @extensions.include?(data.extension) or
    @mime_types.include?(data.mime_type)
end