Class: PolishInvoicer::Writer
- Inherits:
-
Object
- Object
- PolishInvoicer::Writer
- Defined in:
- lib/polish_invoicer/writer.rb
Instance Attribute Summary collapse
-
#invoice ⇒ Object
Returns the value of attribute invoice.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#wkhtmltopdf_command ⇒ Object
Returns the value of attribute wkhtmltopdf_command.
-
#wkhtmltopdf_path ⇒ Object
Returns the value of attribute wkhtmltopdf_path.
Instance Method Summary collapse
-
#initialize(invoice) ⇒ Writer
constructor
A new instance of Writer.
- #save_to_html(path) ⇒ Object
- #save_to_pdf(path) ⇒ Object
- #template_path ⇒ Object
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
#invoice ⇒ Object
Returns the value of attribute invoice.
5 6 7 |
# File 'lib/polish_invoicer/writer.rb', line 5 def invoice @invoice end |
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/polish_invoicer/writer.rb', line 5 def logger @logger end |
#wkhtmltopdf_command ⇒ Object
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_path ⇒ Object
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_path ⇒ Object
24 25 26 27 |
# File 'lib/polish_invoicer/writer.rb', line 24 def template_path tpl = invoice.template_file invoice.template_path || File.("../../../tpl/#{tpl}", __FILE__) end |