Sha256: de4b43703cd9778e0233a05262daf1c16e044b8699b5449b9d0201a7fb0a9361
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
module PolishInvoicer class Writer attr_accessor :invoice, :template_path attr_accessor :logger, :wkhtmltopdf_path, :wkhtmltopdf_command def initialize(invoice) @invoice = invoice default_template_path = File.expand_path('../../../tpl/invoice.slim', __FILE__) @template_path = @invoice.template_path || default_template_path @logger = @invoice.logger @wkhtmltopdf_path = @invoice.wkhtmltopdf_path @wkhtmltopdf_command = @invoice.wkhtmltopdf_command end def save_to_html(path) create_writer @writer.save_to_html(path) end def save_to_pdf(path) create_writer @writer.save_to_pdf(path) end protected def create_writer @writer = Slim2pdf::Writer.new(template_path) @writer.wkhtmltopdf_path = wkhtmltopdf_path @writer.wkhtmltopdf_command = wkhtmltopdf_command @writer.logger = logger data = @invoice.to_hash @writer.data = data @writer.footer_text = data[:footer] end end end
Version data entries
4 entries across 4 versions & 1 rubygems