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