Class: USPSFlags::Core::Headers

Inherits:
Object
  • Object
show all
Defined in:
lib/usps_flags/core/headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(width: nil, height: nil, pennant: false, scale: nil, title: 'USPS Flag') ⇒ Headers

Returns a new instance of Headers.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/usps_flags/core/headers.rb', line 10

def initialize(width: nil, height: nil, pennant: false, scale: nil, title: 'USPS Flag')
  @width = width
  @height = height
  @title = title
  scale ||= 3
  @generated_at = Time.now.strftime('%Y%m%d.%H%S%z')

  if @width.nil? || @height.nil?
    no_sizes(scale, pennant)
  else
    set_view_size(width, height, scale)
  end
end

Instance Method Details

#svgObject



24
25
26
27
28
29
30
31
# File 'lib/usps_flags/core/headers.rb', line 24

def svg
  svg = +''
  svg << header_top
  svg << trademark unless @title == 'US Ensign'
  svg << '</metadata>'

  svg
end