Sha256: ebdc6e53ae32b38cd0da1f3df3df3ad3efc7616b63b0b4c14c05d9f0c4ca60b8
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
module PolishInvoicer class Writer attr_accessor :invoice attr_accessor :logger, :wkhtmltopdf_path, :wkhtmltopdf_command def initialize(invoice) @invoice = invoice @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 def template_path tpl = invoice.template_file invoice.template_path || File.expand_path("../../../tpl/#{tpl}", __FILE__) end private 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polish_invoicer-0.0.26 | lib/polish_invoicer/writer.rb |