Class: FacturaePrint::Renderers::HTMLRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/facturae_print/renderers/html_renderer.rb

Instance Method Summary collapse

Constructor Details

#initialize(template, invoice) ⇒ HTMLRenderer

Returns a new instance of HTMLRenderer.



7
8
9
10
# File 'lib/facturae_print/renderers/html_renderer.rb', line 7

def initialize(template, invoice)
  @template = template
  @invoice = invoice
end

Instance Method Details

#renderObject



12
13
14
15
16
17
18
19
20
# File 'lib/facturae_print/renderers/html_renderer.rb', line 12

def render
  eruby = Erubis::Eruby.new(@template)
  __context = Erubis::Context.new
  class << __context
    include FacturaePrint::Renderers::HTMLRendererHelpers
  end
  __context[:invoice] = @invoice
  eruby.evaluate(__context)
end