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


60
61
62
# File 'lib/wisepdf/configuration.rb', line 60

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)

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

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

.production?Boolean

Returns:

  • (Boolean)

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

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

.reset!Object


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

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

.test?Boolean

Returns:

  • (Boolean)

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

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

.use_asset_pipeline?Boolean

Returns:

  • (Boolean)

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

def use_asset_pipeline?
  return true if ::Rails.configuration.assets.enabled.nil?

  !!(::Rails.configuration.assets.enabled)
end

.windows?Boolean

Returns:

  • (Boolean)

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

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