Permalink
Browse files

DRY up app.rb

  • Loading branch information...
1 parent fdaf8ca commit 0731eb29e2b4c0acaf2b17c0764d381c8b609512 @greggersh greggersh committed Oct 4, 2012
Showing with 5 additions and 9 deletions.
  1. +5 −9 app.rb
View
@@ -17,27 +17,23 @@
# return a filled PDF as a result of post data
post '/fill' do
- pdf = PdfFiller.new
- send_file pdf.fill( params['pdf'], params ).path, :type => "application/pdf", :filename => File.basename( params['pdf'] ), :disposition => :inline
+ send_file PdfFiller.new.fill( params['pdf'], params ).path, :type => "application/pdf", :filename => File.basename( params['pdf'] ), :disposition => :inline
end
# get an HTML listing of all the fields
# e.g., /fields.html?pdf=http://help.adobe.com/en_US/Acrobat/9.0/Samples/interactiveform_enabled.pdf
get '/fields' do
- pdf = PdfFiller.new
- liquid :fields, :locals => { :pdf => params['pdf'], :fields => pdf.get_fields( params['pdf'] ) }, :layout => :bootstrap
+ liquid :fields, :locals => { :pdf => params['pdf'], :fields => PdfFiller.new.get_fields( params['pdf'] ) }, :layout => :bootstrap
end
# return JSON list of field names
# e.g., /fields.json?pdf=http://help.adobe.com/en_US/Acrobat/9.0/Samples/interactiveform_enabled.pdf
get '/fields.json' do
- pdf = PdfFiller.new
- pdf.get_fields( params['pdf'] ).to_json
+ PdfFiller.new.get_fields( params['pdf'] ).to_json
end
# get an HTML representation of the form
# e.g., /form.html?pdf=http://help.adobe.com/en_US/Acrobat/9.0/Samples/interactiveform_enabled.pdf
get '/form' do
- pdf = PdfFiller.new
- liquid :form, :locals => { :pdf => params['pdf'], :fields => pdf.get_fields( params['pdf'] ) }, :layout => :bootstrap
-end
+ liquid :form, :locals => { :pdf => params['pdf'], :fields => PdfFiller.new.get_fields( params['pdf'] ) }, :layout => :bootstrap
+end

0 comments on commit 0731eb2

Please sign in to comment.