Class: PolishInvoicer::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/polish_invoicer/writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice) ⇒ Writer

Returns a new instance of Writer.



7
8
9
10
11
12
# File 'lib/polish_invoicer/writer.rb', line 7

def initialize(invoice)
  @invoice = invoice
  @logger = @invoice.logger
  @wkhtmltopdf_path = @invoice.wkhtmltopdf_path
  @wkhtmltopdf_command = @invoice.wkhtmltopdf_command
end

Instance Attribute Details

#invoiceObject

Returns the value of attribute invoice.



5
6
7
# File 'lib/polish_invoicer/writer.rb', line 5

def invoice
  @invoice
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/polish_invoicer/writer.rb', line 5

def logger
  @logger
end

#wkhtmltopdf_commandObject

Returns the value of attribute wkhtmltopdf_command.



5
6
7
# File 'lib/polish_invoicer/writer.rb', line 5

def wkhtmltopdf_command
  @wkhtmltopdf_command
end

#wkhtmltopdf_pathObject

Returns the value of attribute wkhtmltopdf_path.



5
6
7
# File 'lib/polish_invoicer/writer.rb', line 5

def wkhtmltopdf_path
  @wkhtmltopdf_path
end

Instance Method Details

#save_to_html(path) ⇒ Object



14
15
16
17
# File 'lib/polish_invoicer/writer.rb', line 14

def save_to_html(path)
  create_writer
  @writer.save_to_html(path)
end

#save_to_pdf(path) ⇒ Object



19
20
21
22
# File 'lib/polish_invoicer/writer.rb', line 19

def save_to_pdf(path)
  create_writer
  @writer.save_to_pdf(path)
end

#template_pathObject



24
25
26
27
# File 'lib/polish_invoicer/writer.rb', line 24

def template_path
  tpl = invoice.template_file
  invoice.template_path || File.expand_path("../../../tpl/#{tpl}", __FILE__)
end