Module: Sinatra::Prawn::Helpers

Defined in:
lib/sinatra/prawn.rb

Instance Method Summary collapse

Instance Method Details

#prawn(template = nil, options = {}, locals = {}, &block) ⇒ Object

Generate pdf file using Prawn. Takes the name of a template to render as a Symbol and returns a String with the rendered output.

Options for prawn may be specified in Sinatra using set :prawn, { … }



10
11
12
13
14
15
# File 'lib/sinatra/prawn.rb', line 10

def prawn(template=nil, options={}, locals = {}, &block)
  options, template = template, nil if template.is_a?(Hash)
  template = lambda { block } if template.nil?
  options[:layout] = false
  render :prawn, template, options, locals
end