Sha256: d468d9b3382d18f008b0bc5355566a5a86df5d02c7d6c751100b3014a2333f6d
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'singleton' module Wisepdf class Configuration include Singleton class << self attr_accessor :options attr_accessor :wkhtmltopdf def wkhtmltopdf return @wkhtmltopdf if @wkhtmltopdf.present? if @wkhtmltopdf.nil? && !self.windows? @wkhtmltopdf = (defined?(Bundler) ? `bundle exec which wkhtmltopdf` : `which wkhtmltopdf`).chomp end return @wkhtmltopdf end def configure yield self end def use_asset_pipeline? return true if ::Rails.configuration.assets.enabled.nil? !!(::Rails.configuration.assets.enabled) end def reset! @options = { :encoding => "UTF-8", :use_xserver => false } @wkhtmltopdf = nil end def development? (defined?(::Rails) && ::Rails.env == 'development') || (defined?(RAILS_ENV) && RAILS_ENV == 'development') end def test? (defined?(::Rails) && ::Rails.env == 'test') || (defined?(RAILS_ENV) && RAILS_ENV == 'test') end def production? (defined?(::Rails) && ::Rails.env == 'production') || (defined?(RAILS_ENV) && RAILS_ENV == 'production') end def windows? RbConfig::CONFIG['target_os'] == 'mingw32' end end self.reset! def method_missing(method) self.class.send(method) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wisepdf-1.4.0 | lib/wisepdf/configuration.rb |
wisepdf-1.3.1 | lib/wisepdf/configuration.rb |