Class: Squib::Commands::MakeSprue

Inherits:
Object
  • Object
show all
Defined in:
lib/squib/commands/make_sprue.rb

Overview

Generate a template definition file that can be used for save_templated_sheet

Instance Method Summary collapse

Instance Method Details

#process(args, input = $stdin, output = $stdout) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

:nodoc:


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/squib/commands/make_sprue.rb', line 18

def process(args, input = $stdin, output = $stdout)
  # Get definitions from the user
  @option = prompt(input, output)

  @printable_edge_right = (
    @option.sheet_width - @option.sheet_margin.right)
  @printable_edge_bottom = (
    @option.sheet_height - @option.sheet_margin.bottom)
  @card_iter_x = @option.card_width + @option.card_gap.horizontal
  @card_iter_y = @option.card_height + @option.card_gap.vertical

  # Recalculate the sheet margin if the sheet alignment is in the center
  if @option.sheet_align == :center
    @option.sheet_margin = recalculate_center_align_sheet
  end

  # We would now have to output the file
  YAML.dump generate_template, File.new(@option.output_file, 'w')
end