Class: ProxyMate

Inherits:
Object
  • Object
show all
Defined in:
lib/proxy_mate.rb,
lib/proxy_mate/version.rb

Overview

rubocop:disable Style/Documentation

Constant Summary collapse

PAGE_SIZE =
'A4'
PAGE_WIDTH =
210.mm
PAGE_HEIGHT =
297.mm
CARD_WIDTH =
63.5.mm
CARD_HEIGHT =
88.9.mm
X_GAP =
(PAGE_WIDTH - 3 * CARD_WIDTH) / 4
Y_GAP =
(PAGE_HEIGHT - 3 * CARD_HEIGHT) / 4
CARDS_PER_PAGE =
9
VERSION =
'0.0.1'

Instance Method Summary collapse

Constructor Details

#initialize(card_image_paths, file_name) ⇒ ProxyMate

Returns a new instance of ProxyMate.



17
18
19
20
# File 'lib/proxy_mate.rb', line 17

def initialize(card_image_paths, file_name)
  @card_image_paths = card_image_paths
  @file_name = file_name
end

Instance Method Details

#generateObject



22
23
24
25
26
27
28
29
# File 'lib/proxy_mate.rb', line 22

def generate
  Prawn::Document.generate(file_name, document_options) do |pdf|
    card_image_paths.each.with_index do |card_image_path, i|
      pdf.start_new_page if (i % CARDS_PER_PAGE).zero? && i.positive?
      add_card(pdf, card_image_path)
    end
  end
end