Class: Libis::Format::Converter::PdfAssembler

Inherits:
Base
  • Object
show all
Defined in:
lib/libis/format/converter/pdf_assembler.rb

Overview

noinspection DuplicatedCode

Instance Attribute Summary

Attributes inherited from Base

#flags, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#check_file_exist, inherited, #initialize, using_temp, #using_temp

Constructor Details

This class inherits a constructor from Libis::Format::Converter::Base

Class Method Details

.categoryObject



23
24
25
# File 'lib/libis/format/converter/pdf_assembler.rb', line 23

def self.category
  :assembler
end

.input_typesObject



14
15
16
# File 'lib/libis/format/converter/pdf_assembler.rb', line 14

def self.input_types
  [:PDF]
end

.output_types(format = nil) ⇒ Object



18
19
20
21
# File 'lib/libis/format/converter/pdf_assembler.rb', line 18

def self.output_types(format = nil)
  return [] unless input_types.include?(format) if format
  [:PDF]
end

Instance Method Details

#convert(source, target, format, opts = {}) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/libis/format/converter/pdf_assembler.rb', line 31

def convert(source, target, format, opts = {})
  super

  result = if source.is_a? Array
             assemble(source, target)
           elsif File.directory?(source)
             source_list = Dir[File.join(source, '**', '*')].reject {|p| File.directory? p}
             assemble(source_list, target)
           else
             assemble([source], target)
           end
  return nil unless result

  result
end

#pdf_assemnble(_) ⇒ Object



27
28
29
# File 'lib/libis/format/converter/pdf_assembler.rb', line 27

def pdf_assemnble(_)
  #force usage of this converter
end