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 Attribute Summary collapse

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, slow_pc: false) ⇒ PrintSettings

Returns a new instance of PrintSettings.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/postdoc/print_settings.rb', line 8

def initialize(
    header_template: '',
    footer_template: '',
    landscape: false,
    print_background: true,
    margin_top: 1,
    margin_bottom: 1,
    margin_left: 1,
    margin_right: 1,
    slow_pc: false
)
  @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
  @slow_pc = slow_pc
end

Instance Attribute Details

#slow_pcObject

Returns the value of attribute slow_pc.



6
7
8
# File 'lib/postdoc/print_settings.rb', line 6

def slow_pc
  @slow_pc
end

Instance Method Details

#to_cmdObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/postdoc/print_settings.rb', line 30

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