Class: Wisepdf::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/wisepdf/configuration.rb

Class Attribute Summary collapse

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



54
55
56
# File 'lib/wisepdf/configuration.rb', line 54

def method_missing(method)
  self.class.send(method)
end

Class Attribute Details

.optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/wisepdf/configuration.rb', line 8

def options
  @options
end

.wkhtmltopdfObject

Returns the value of attribute wkhtmltopdf.



9
10
11
# File 'lib/wisepdf/configuration.rb', line 9

def wkhtmltopdf
  @wkhtmltopdf
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



20
21
22
# File 'lib/wisepdf/configuration.rb', line 20

def configure
  yield self
end

.development?Boolean

Returns:

  • (Boolean)


32
33
34
35
# File 'lib/wisepdf/configuration.rb', line 32

def development?
  (defined?(::Rails) && ::Rails.env == 'development') ||
    (defined?(RAILS_ENV) && RAILS_ENV == 'development')
end

.production?Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/wisepdf/configuration.rb', line 42

def production?
  (defined?(::Rails) && ::Rails.env == 'production') ||
    (defined?(RAILS_ENV) && RAILS_ENV == 'production')
end

.reset!Object



24
25
26
27
28
29
30
# File 'lib/wisepdf/configuration.rb', line 24

def reset!
  @options = {
    :encoding => "UTF-8",
    :use_xserver => false
  }
  @wkhtmltopdf = nil
end

.test?Boolean

Returns:

  • (Boolean)


37
38
39
40
# File 'lib/wisepdf/configuration.rb', line 37

def test?
  (defined?(::Rails) && ::Rails.env == 'test') ||
    (defined?(RAILS_ENV) && RAILS_ENV == 'test')
end

.windows?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/wisepdf/configuration.rb', line 47

def windows?
  RbConfig::CONFIG['target_os'] == 'mingw32'
end