Class: Poleica::Converters::LibreOffice::OptionsGenerator
- Inherits:
-
Object
- Object
- Poleica::Converters::LibreOffice::OptionsGenerator
- Defined in:
- lib/poleica/converters/libre_office.rb
Overview
Generate options for the soffice command
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#polei ⇒ Object
readonly
Returns the value of attribute polei.
Instance Method Summary collapse
- #default_options ⇒ Object
- #generate ⇒ Object
-
#initialize(polei, options = {}, format = :pdf) ⇒ OptionsGenerator
constructor
A new instance of OptionsGenerator.
-
#temp_path ⇒ Object
Generate a temp path, and create the file this is needed in order to have the right filename, LibreOffice just copy the original filename in the choosen directory, it doesn’t accept filename params.
Constructor Details
#initialize(polei, options = {}, format = :pdf) ⇒ OptionsGenerator
Returns a new instance of OptionsGenerator.
34 35 36 37 38 39 |
# File 'lib/poleica/converters/libre_office.rb', line 34 def initialize(polei, = {}, format = :pdf) @polei = polei @format = format @output_path = [:path] || polei.path_with_md5(format) @options = .merge() end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
32 33 34 |
# File 'lib/poleica/converters/libre_office.rb', line 32 def format @format end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
32 33 34 |
# File 'lib/poleica/converters/libre_office.rb', line 32 def @options end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
32 33 34 |
# File 'lib/poleica/converters/libre_office.rb', line 32 def output_path @output_path end |
#polei ⇒ Object (readonly)
Returns the value of attribute polei.
32 33 34 |
# File 'lib/poleica/converters/libre_office.rb', line 32 def polei @polei end |
Instance Method Details
#default_options ⇒ Object
41 42 43 |
# File 'lib/poleica/converters/libre_office.rb', line 41 def { path: polei.path_with_md5 } end |
#generate ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/poleica/converters/libre_office.rb', line 45 def generate [ default_arguments, format, ].flatten end |
#temp_path ⇒ Object
Generate a temp path, and create the file this is needed in order to have the right filename, LibreOffice just copy the original filename in the choosen directory, it doesn’t accept filename params.
57 58 59 60 61 |
# File 'lib/poleica/converters/libre_office.rb', line 57 def temp_path @temp_path ||= generate_temp_path FileUtils.cp(polei.path, @temp_path) unless File.exist?(@temp_path) @temp_path end |