Class: WeasyPDF::Configuration
- Inherits:
-
Object
- Object
- WeasyPDF::Configuration
- Defined in:
- lib/weasy_pdf/configuration.rb
Constant Summary collapse
- DEFAULTS =
{ page_size: "A4", orientation: "Portrait", margin_top: "10mm", margin_bottom: "10mm", margin_left: "10mm", margin_right: "10mm", encoding: "utf-8", zoom: 1, media_type: "print" # WeasyPrint defaults to 'screen'; 'print' activates @media print rules }.freeze
- BINARY_CANDIDATES =
%w[ /usr/local/bin/weasyprint /usr/bin/weasyprint /opt/weasyprint/bin/weasyprint /opt/homebrew/bin/weasyprint ].freeze
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#default_options ⇒ Object
Returns the value of attribute default_options.
-
#exe_path ⇒ Object
Returns the value of attribute exe_path.
-
#temp_path ⇒ Object
Returns the value of attribute temp_path.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
26 27 28 29 30 31 32 |
# File 'lib/weasy_pdf/configuration.rb', line 26 def initialize @exe_path = find_binary @default_options = DEFAULTS.dup @base_url = nil @timeout = 60 @temp_path = default_temp_path end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
24 25 26 |
# File 'lib/weasy_pdf/configuration.rb', line 24 def base_url @base_url end |
#default_options ⇒ Object
Returns the value of attribute default_options.
24 25 26 |
# File 'lib/weasy_pdf/configuration.rb', line 24 def @default_options end |
#exe_path ⇒ Object
Returns the value of attribute exe_path.
24 25 26 |
# File 'lib/weasy_pdf/configuration.rb', line 24 def exe_path @exe_path end |
#temp_path ⇒ Object
Returns the value of attribute temp_path.
24 25 26 |
# File 'lib/weasy_pdf/configuration.rb', line 24 def temp_path @temp_path end |
#timeout ⇒ Object
Returns the value of attribute timeout.
24 25 26 |
# File 'lib/weasy_pdf/configuration.rb', line 24 def timeout @timeout end |
Instance Method Details
#[](key) ⇒ Object
34 35 36 |
# File 'lib/weasy_pdf/configuration.rb', line 34 def [](key) public_send(key) end |
#[]=(key, value) ⇒ Object
38 39 40 |
# File 'lib/weasy_pdf/configuration.rb', line 38 def []=(key, value) public_send(:"#{key}=", value) end |