Method: Squib::DSL::CutZone#run

Defined in:
lib/squib/dsl/cut_zone.rb

#run(opts) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/squib/dsl/cut_zone.rb', line 27

def run(opts)
  warn_if_unexpected opts
  cut_defaults = {
    margin: '0.125in',
    radius: '0.125in',
    stroke_color: :red,
    fill_color: '#0000',
    stroke_width: 2.0,
  }
  new_opts = cut_defaults.merge(opts)
  margin = Args::UnitConversion.parse new_opts[:margin], @deck.dpi, @deck.cell_px
  new_opts[:x] = margin
  new_opts[:y] = margin
  new_opts[:width] = deck.width - (2 * margin)
  new_opts[:height] = deck.height - (2 * margin)
  new_opts.delete :margin
  deck.rect new_opts
end