Class: Browserless::Options
- Inherits:
-
Object
- Object
- Browserless::Options
- Defined in:
- lib/browserless/options.rb
Constant Summary collapse
- HEADER_TEMPLATE =
empty header
"<div></div>"
- FOOTER_TEMPLATE =
"<div style='font-size: 11px; margin-left: 40px; font: Helvetica'><span class='pageNumber'></span> of <span class='totalPages'></span></div>"
Instance Attribute Summary collapse
-
#display_header_footer ⇒ Object
readonly
Returns the value of attribute display_header_footer.
-
#footer_template ⇒ Object
readonly
Returns the value of attribute footer_template.
-
#header_template ⇒ Object
readonly
Returns the value of attribute header_template.
-
#landscape ⇒ Object
readonly
Returns the value of attribute landscape.
-
#margin ⇒ Object
readonly
Returns the value of attribute margin.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pdf_format ⇒ Object
readonly
Returns the value of attribute pdf_format.
-
#print_background ⇒ Object
readonly
Returns the value of attribute print_background.
Instance Method Summary collapse
-
#initialize(**options) ⇒ Options
constructor
A new instance of Options.
- #to_h ⇒ Object
Constructor Details
#initialize(**options) ⇒ Options
Returns a new instance of Options.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/browserless/options.rb', line 10 def initialize(**) = @landscape = config_value(:landscape) || false @margin = config_value(:margin) || {} @pdf_format = config_value(:format) || "A4" @print_background = config_value(:print_background) || false @header_template = config_value(:header_template) || HEADER_TEMPLATE = config_value(:footer_template) || FOOTER_TEMPLATE = config_value(:display_header_footer) || false end |
Instance Attribute Details
#display_header_footer ⇒ Object (readonly)
Returns the value of attribute display_header_footer.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def end |
#footer_template ⇒ Object (readonly)
Returns the value of attribute footer_template.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def end |
#header_template ⇒ Object (readonly)
Returns the value of attribute header_template.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def header_template @header_template end |
#landscape ⇒ Object (readonly)
Returns the value of attribute landscape.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def landscape @landscape end |
#margin ⇒ Object (readonly)
Returns the value of attribute margin.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def margin @margin end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def end |
#pdf_format ⇒ Object (readonly)
Returns the value of attribute pdf_format.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def pdf_format @pdf_format end |
#print_background ⇒ Object (readonly)
Returns the value of attribute print_background.
8 9 10 |
# File 'lib/browserless/options.rb', line 8 def print_background @print_background end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/browserless/options.rb', line 21 def to_h { landscape: landscape, displayHeaderFooter: , printBackground: print_background, margin: margin, format: pdf_format, headerTemplate: header_template, footerTemplate: } end |