Skip to content
Browse files

Change from always executing `which wkhtmltopdf` to only executing it…

… if the binary file's location is not explicitly stated in config.
  • Loading branch information...
1 parent 89013da commit 8ee2d3262f2348554014e1a0842ac0bfbb8bbd99 Alex Redington committed Dec 27, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/pdfkit/configuration.rb
View
8 lib/pdfkit/configuration.rb
@@ -1,10 +1,10 @@
class PDFKit
class Configuration
- attr_accessor :meta_tag_prefix, :wkhtmltopdf, :default_options
+ attr_accessor :meta_tag_prefix, :default_options
+ attr_writer :wkhtmltopdf
def initialize
@meta_tag_prefix = 'pdfkit-'
- @wkhtmltopdf = `which wkhtmltopdf`.chomp
@default_options = {
:disable_smart_shrinking => true,
:page_size => 'Letter',
@@ -15,6 +15,10 @@ def initialize
:encoding => "UTF-8"
}
end
+
+ def wkhtmltopdf
+ @wkhtmltopdf ||= `which wkhtmltopdf`.chomp
+ end
end
class << self

0 comments on commit 8ee2d32

Please sign in to comment.
Something went wrong with that request. Please try again.