Class: Pdf2htmlDocker::Service
- Inherits:
-
Object
- Object
- Pdf2htmlDocker::Service
- Defined in:
- lib/pdf2html_docker/service.rb
Instance Attribute Summary collapse
- #command ⇒ Object
-
#command_options ⇒ Object
readonly
Returns the value of attribute command_options.
-
#input_dir ⇒ Object
readonly
Returns the value of attribute input_dir.
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
-
#initialize(input_file, output_file = '', options = {}) ⇒ Service
constructor
A new instance of Service.
- #run ⇒ Object
Constructor Details
#initialize(input_file, output_file = '', options = {}) ⇒ Service
Returns a new instance of Service.
14 15 16 17 18 19 |
# File 'lib/pdf2html_docker/service.rb', line 14 def initialize(input_file, output_file = '', = {}) @input_dir, @input_file = process_input_file(input_file) args = { pdf: @input_file, html: output_file } @command_options = OptionBuilder.new(args, ) @line = ::Terrapin::CommandLine.new(command, @command_options.to_s) end |
Instance Attribute Details
#command ⇒ Object
27 28 29 |
# File 'lib/pdf2html_docker/service.rb', line 27 def command @command ||= "#{DOCKER_COMMAND} #{@input_dir}#{DOCKER_VOLUME} #{DOCKER_IMAGE} #{BASE_COMMAND}" end |
#command_options ⇒ Object (readonly)
Returns the value of attribute command_options.
11 12 13 |
# File 'lib/pdf2html_docker/service.rb', line 11 def @command_options end |
#input_dir ⇒ Object (readonly)
Returns the value of attribute input_dir.
11 12 13 |
# File 'lib/pdf2html_docker/service.rb', line 11 def input_dir @input_dir end |
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
11 12 13 |
# File 'lib/pdf2html_docker/service.rb', line 11 def input_file @input_file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
11 12 13 |
# File 'lib/pdf2html_docker/service.rb', line 11 def line @line end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 |
# File 'lib/pdf2html_docker/service.rb', line 21 def run @line.run(@command_options.to_h) rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError => e e end |