Class: Mack::Rendering::Engine::Pdf

Inherits:
Base
  • Object
show all
Defined in:
lib/mack-pdf_writer/pdf_engine.rb

Defined Under Namespace

Modules: ViewHelpers

Instance Method Summary collapse

Instance Method Details

#extensionObject



16
17
18
# File 'lib/mack-pdf_writer/pdf_engine.rb', line 16

def extension
  :pdfw
end

#render(io, binding) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/mack-pdf_writer/pdf_engine.rb', line 6

def render(io, binding)
  if io.is_a?(File)
    io = io.read
  end
  @_pdf = ::PDF::Writer.new
  self.view_template.instance_variable_set("@_pdf", @_pdf)
  eval(io, binding)
  @_pdf.render
end