Module: Dieses::Application::Paper::DSL

Included in:
Dieses::Application::Paper
Defined in:
lib/dieses/application/paper.rb

Constant Summary collapse

VARIANTS =
[
  { suffix: 'n', floor: 7.0  }, # Narrow margins (default)
  { suffix: 'm', floor: 12.0 }, # Medium margins: bare minimum margin to accommodate ISO 838 filing holes
  { suffix: 'w', floor: 20.0 }  # Wide margins: safe minimum margin to accommodate ISO 838 filing holes
].freeze

Instance Method Summary collapse

Instance Method Details

#family(type, width:, height:, scale: nil) ⇒ Object



76
77
78
79
80
81
82
83
84
85
# File 'lib/dieses/application/paper.rb', line 76

def family(type, width:, height:, scale: nil)
  VARIANTS.map do |hash|
    name  = :"#{type}#{hash[:suffix]}"
    floor = hash[:floor]
    Variant.new(type: type, name: name, width: width, height: height, floor: floor, scale: scale).tap(&:build)
  end.first.tap do |variant| # rubocop:disable Style/MultilineBlockChain
    # set the first variant as the default paper
    (class << self; self; end).alias_method type, variant.name
  end
end