class Tilt::PrawnTemplate

Prawn template implementation. See: prawnpdf.org

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
Calls superclass method
   # File lib/tilt/prawn.rb
16 def evaluate(scope, locals, &block)
17   pdf = @engine
18   if @data.respond_to?(:to_str)
19     locals = locals.dup
20     locals[:pdf] = pdf
21     super
22   else
23     warn "Non-string provided as prawn template data. This is no longer supported and support for it will be removed in Tilt 2.3", :uplevel=>2
24     # :nocov:
25     @data.call(pdf) if @data.kind_of?(Proc)
26     # :nocov:
27   end
28   pdf.render
29 end
precompiled_template(locals) click to toggle source
   # File lib/tilt/prawn.rb
31 def precompiled_template(locals)
32   @data.to_str
33 end
prepare() click to toggle source
   # File lib/tilt/prawn.rb
10 def prepare
11   @options[:page_size] = 'A4' unless @options.has_key?(:page_size)
12   @options[:page_layout] = :portrait unless @options.has_key?(:page_layout)
13   @engine = ::Prawn::Document.new(@options)
14 end