class Squib::DSL::SavePDF

Attributes

deck[R]
dsl_method[R]

Public Class Methods

accepted_params() click to toggle source
# File lib/squib/dsl/save_pdf.rb, line 24
def self.accepted_params
  %i(
    file dir sprue
    width height margin gap
    crop_marks crop_stroke_color crop_stroke_dash crop_stroke_width
    crop_margin_bottom crop_margin_left crop_margin_right crop_margin_top
    rtl trim trim_radius
    range
   )
end
new(deck, dsl_method) click to toggle source
# File lib/squib/dsl/save_pdf.rb, line 18
def initialize(deck, dsl_method)
  @deck = deck
  @dsl_method = dsl_method
  @bar = deck.progress_bar
end

Public Instance Methods

run(opts) click to toggle source
# File lib/squib/dsl/save_pdf.rb, line 35
def run(opts)
  warn_if_unexpected opts
  range = Args.extract_range opts, deck
  sheet = Args.extract_sheet opts, deck
  sprue_file = Args.extract_sprue_file opts, deck
  if sprue_file.sprue.nil?
    Graphics::SavePDF.new(deck).render_pdf(range, sheet)
  else
    tmpl = Sprue.load sprue_file.sprue, deck.dpi, deck.cell_px
    Graphics::SaveSpruePDF.new(deck, tmpl, sheet).render_sheet(range)
  end

end