Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

New helpers in 1.3 #4

Merged
merged 1 commit into from

2 participants

@mk0x9

No description provided.

@sbfaulkner sbfaulkner merged commit 05fbd75 into sbfaulkner:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 19, 2011
  1. @mk0x9

    now works with sinatra 1.3

    mk0x9 authored
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 11 deletions.
  1. +17 −11 lib/sinatra/prawn.rb
View
28 lib/sinatra/prawn.rb
@@ -2,19 +2,25 @@
module Sinatra
module Prawn
- # 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, { ... }
- 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
+ module Helpers
+ # 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, { ... }
+ 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
+ end
+
+ def self.registered(app)
+ app.helpers Prawn::Helpers
end
end
- helpers Prawn
+ register Prawn
end
@@ -45,4 +51,4 @@ def precompiled_template(locals)
end
end
register 'prawn', PrawnTemplate
-end
+end
Something went wrong with that request. Please try again.