Class: Postsvg::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/postsvg/options.rb

Overview

Shared options for both directions. Frozen on construction.

Constant Summary collapse

DEFAULT_PAGE_SIZE =

A4 in PostScript points

[595, 842].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(eps: false, width: nil, height: nil, viewbox_override: nil, verbose: false, page_size: nil) ⇒ Options

Returns a new instance of Options.



10
11
12
13
14
15
16
17
18
19
# File 'lib/postsvg/options.rb', line 10

def initialize(eps: false, width: nil, height: nil, viewbox_override: nil,
               verbose: false, page_size: nil)
  @eps = eps
  @width = width
  @height = height
  @viewbox_override = viewbox_override
  @verbose = verbose
  @page_size = page_size || DEFAULT_PAGE_SIZE
  freeze
end

Instance Attribute Details

#epsObject (readonly)

Returns the value of attribute eps.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def eps
  @eps
end

#heightObject (readonly)

Returns the value of attribute height.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def height
  @height
end

#page_sizeObject (readonly)

Returns the value of attribute page_size.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def page_size
  @page_size
end

#verboseObject (readonly)

Returns the value of attribute verbose.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def verbose
  @verbose
end

#viewbox_overrideObject (readonly)

Returns the value of attribute viewbox_override.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def viewbox_override
  @viewbox_override
end

#widthObject (readonly)

Returns the value of attribute width.



6
7
8
# File 'lib/postsvg/options.rb', line 6

def width
  @width
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
# File 'lib/postsvg/options.rb', line 21

def to_h
  {
    eps: @eps, width: @width, height: @height,
    viewbox_override: @viewbox_override, verbose: @verbose,
    page_size: @page_size,
  }
end