Class: Postdoc::PrintSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/postdoc/print_settings.rb

Overview

Different prints require different settings. This class is used instead of passing options arguments throughout all of the code.

Instance Method Summary collapse

Constructor Details

#initialize(header_template: '', footer_template: '', landscape: false, print_background: true, margin_top: 1, margin_bottom: 1, margin_left: 1, margin_right: 1) ⇒ PrintSettings

Returns a new instance of PrintSettings.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/postdoc/print_settings.rb', line 5

def initialize(
    header_template: '',
    footer_template: '',
    landscape: false,
    print_background: true,
    margin_top: 1,
    margin_bottom: 1,
    margin_left: 1,
    margin_right: 1
)
  @header_template = header_template
  @footer_template = footer_template
  @landscape = landscape
  @print_background = print_background
  @margin_top = margin_top
  @margin_bottom = margin_bottom
  @margin_left = margin_left
  @margin_right = margin_right
end

Instance Method Details

#to_cmdObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/postdoc/print_settings.rb', line 25

def to_cmd
  { landscape: @landscape,
    printBackground: true,
    marginTop: @margin_top,
    marginBottom: @margin_bottom,
    marginLeft: @margin_left,
    marginRight: @margin_right,
    displayHeaderFooter: display_header_and_footer?,
    headerTemplate: @header_template,
    footerTemplate: @footer_template }
end