class Tilt::PrawnTemplate
Prawn template implementation. See: prawnpdf.org
Public Instance Methods
allows_script?()
click to toggle source
# File lib/tilt/prawn.rb, line 25 def allows_script? false end
evaluate(scope, locals, &block)
click to toggle source
Calls superclass method
Template#evaluate
# File lib/tilt/prawn.rb, line 14 def evaluate(scope, locals, &block) pdf = @engine if data.respond_to?(:to_str) locals[:pdf] = pdf super(scope, locals, &block) elsif data.kind_of?(Proc) data.call(pdf) end @output ||= pdf.render end
precompiled_template(locals)
click to toggle source
# File lib/tilt/prawn.rb, line 29 def precompiled_template(locals) data.to_str end
prepare()
click to toggle source
# File lib/tilt/prawn.rb, line 10 def prepare @engine = ::Prawn::Document.new(prawn_options) end
Private Instance Methods
prawn_options()
click to toggle source
# File lib/tilt/prawn.rb, line 36 def prawn_options # defaults to A4 instead of crazy US Letter format. { :page_size => "A4", :page_layout => :portrait }.merge(options) end