Class: Pdf2Html::Caller

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf2html/caller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_file, options = {}, output_file = "") ⇒ Caller

Returns a new instance of Caller.



9
10
11
12
13
# 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

Instance Attribute Details

#cmdObject



19
20
21
# File 'lib/pdf2html/caller.rb', line 19

def cmd
  @cmd ||= which('pdf2htmlex') || which('pdf2htmlEX')
end

#cmd_optionsObject (readonly)

Returns the value of attribute cmd_options.



6
7
8
# File 'lib/pdf2html/caller.rb', line 6

def cmd_options
  @cmd_options
end

#lineObject (readonly)

Returns the value of attribute line.



6
7
8
# File 'lib/pdf2html/caller.rb', line 6

def line
  @line
end

Instance Method Details

#runObject



15
16
17
# File 'lib/pdf2html/caller.rb', line 15

def run
  @line.run(@cmd_options.to_h)
end