Class: PuppetPdf::PdfCreator

Inherits:
Object
  • Object
show all
Includes:
Utils::YarnWrapper
Defined in:
lib/puppet_pdf/pdf_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::YarnWrapper

#run_yarn, #validate_yarn_installation

Constructor Details

#initialize(source, options = {}) ⇒ PdfCreator

Returns a new instance of PdfCreator.



11
12
13
14
15
16
17
18
# File 'lib/puppet_pdf/pdf_creator.rb', line 11

def initialize(source, options = {})
  validate_yarn_installation

  @source   = source
  @options  = options.tap do |opt|
    opt[:output_path] = opt.fetch(:output_path, default_output_path)
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



9
10
11
# File 'lib/puppet_pdf/pdf_creator.rb', line 9

def options
  @options
end

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/puppet_pdf/pdf_creator.rb', line 9

def source
  @source
end

Instance Method Details

#callObject



20
21
22
23
# File 'lib/puppet_pdf/pdf_creator.rb', line 20

def call
  run_yarn(:create_pdf, source, options_json)
  options[:output_path]
end