Class: Tilt::PrawnTemplate
Overview
Prawn template implementation. See: prawnpdf.org
Instance Attribute Summary
Attributes inherited from Template
#compiled_path, #data, #file, #line, #options
Instance Method Summary collapse
Methods inherited from Template
#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/tilt/prawn.rb', line 16 def evaluate(scope, locals, &block) pdf = @engine locals = locals.dup locals[:pdf] = pdf super pdf.render end |
#precompiled_template(locals) ⇒ Object
24 25 26 |
# File 'lib/tilt/prawn.rb', line 24 def precompiled_template(locals) @data.to_str end |
#prepare ⇒ Object
10 11 12 13 14 |
# File 'lib/tilt/prawn.rb', line 10 def prepare @options[:page_size] = 'A4' unless @options.has_key?(:page_size) @options[:page_layout] = :portrait unless @options.has_key?(:page_layout) @engine = ::Prawn::Document.new(@options) end |