Class: GnuCash::Invoice::Printer
- Inherits:
-
Object
- Object
- GnuCash::Invoice::Printer
- Defined in:
- lib/gnucash/invoice/printer.rb
Instance Method Summary collapse
- #embedded_asset(pathname) ⇒ Object
- #environment ⇒ Object
-
#initialize(invoice_id, templates) ⇒ Printer
constructor
A new instance of Printer.
- #render ⇒ Object
Constructor Details
Instance Method Details
#embedded_asset(pathname) ⇒ Object
15 16 17 |
# File 'lib/gnucash/invoice/printer.rb', line 15 def pathname environment[pathname].to_s end |
#environment ⇒ Object
20 21 22 23 24 25 |
# File 'lib/gnucash/invoice/printer.rb', line 20 def environment @environment ||= Sprockets::Environment.new(@templates).tap do |env| env.append_path 'assets/stylesheets' env.css_compressor = :sass end end |
#render ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/gnucash/invoice/printer.rb', line 28 def render template = Slim::Template.new @templates.join('invoice.slim').to_s template.render(self, { :invoice => @invoice, :entries => @invoice.entries, :customer => @invoice.customer, :options => Options }) end |