Class: Wisepdf::Configuration
- Inherits:
-
Object
- Object
- Wisepdf::Configuration
show all
- Includes:
- Singleton
- Defined in:
- lib/wisepdf/configuration.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
48
49
50
|
# File 'lib/wisepdf/configuration.rb', line 48
def method_missing(method)
self.class.send(method)
end
|
Class Method Details
19
20
21
|
# File 'lib/wisepdf/configuration.rb', line 19
def configure
yield self
end
|
.development? ⇒ Boolean
31
32
33
34
|
# File 'lib/wisepdf/configuration.rb', line 31
def development?
(defined?(::Rails) && ::Rails.env == 'development') ||
(defined?(RAILS_ENV) && RAILS_ENV == 'development')
end
|
.reset! ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/wisepdf/configuration.rb', line 23
def reset!
@@options = {
:layout => "pdf.html",
:use_xserver => false
}
@@wkhtmltopdf = nil
end
|
.test? ⇒ Boolean
36
37
38
39
|
# File 'lib/wisepdf/configuration.rb', line 36
def test?
(defined?(::Rails) && ::Rails.env == 'test') ||
(defined?(RAILS_ENV) && RAILS_ENV == 'test')
end
|
.windows? ⇒ Boolean
41
42
43
|
# File 'lib/wisepdf/configuration.rb', line 41
def windows?
RbConfig::CONFIG['target_os'] == 'mingw32'
end
|
.wkhtmltopdf ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/wisepdf/configuration.rb', line 10
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
|