module Dieses::Application::Paper::DSL

Constants

VARIANTS

Public Instance Methods

family(type, width:, height:, scale: nil) click to toggle source
# 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