class Pdf2Html::Caller
Attributes
cmd[W]
cmd_options[R]
line[R]
Public Class Methods
new(input_file, options = {}, output_file = "")
click to toggle source
# File lib/pdf2html/caller.rb, line 9 def initialize(input_file, options = {}, output_file = "") args = { pdf: input_file, html: output_file } @cmd_options = OptionProvider.new(args, options) @line = ::Cocaine::CommandLine.new(cmd, @cmd_options.to_s) end
Public Instance Methods
cmd()
click to toggle source
# File lib/pdf2html/caller.rb, line 19 def cmd @cmd ||= which('pdf2htmlex') || which('pdf2htmlEX') end
run()
click to toggle source
# File lib/pdf2html/caller.rb, line 15 def run @line.run(@cmd_options.to_h) end
Private Instance Methods
which(cmd)
click to toggle source
# File lib/pdf2html/caller.rb, line 25 def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable? exe end end return nil end