Sha256: b0c82a3aa43210f6ec39fe8ed036dcbafcd26721d57cc85d8aeeaa3778c8aa8e

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

module Squib
  module Sprues
    UNIT_REGEX = /^(\d*[.])?\d+(in|cm|mm)$/
    ROTATE_REGEX = /^(\d*[.])?\d+(deg|rad)?$/
    SCHEMA = {
      'sheet_width' => UNIT_REGEX,
      'sheet_height' => UNIT_REGEX,
      'card_width' => UNIT_REGEX,
      'card_height' => UNIT_REGEX,
      'position_reference' => ClassyHash::G.enum(:topleft, :center),
      'rotate' => [
        :optional, Numeric,
        ClassyHash::G.enum(:clockwise, :counterclockwise, :turnaround),
        ROTATE_REGEX
      ],
      'crop_line' => {
        'style' => [
          ClassyHash::G.enum(:solid, :dotted, :dashed),
          Sprues::CropLineDash::VALIDATION_REGEX
        ],
        'width' => UNIT_REGEX,
        'color' => [String, Symbol],
        'overlay' => ClassyHash::G.enum(
          :on_margin, :overlay_on_cards, :beneath_cards
        ),
        'lines' => [[{
          'type' => ClassyHash::G.enum(:horizontal, :vertical),
          'position' => UNIT_REGEX,
          'style' => [
            :optional, ClassyHash::G.enum(:solid, :dotted, :dashed)
          ],
          'width' => [:optional, UNIT_REGEX],
          'color' => [:optional, String, Symbol],
          'overlay_on_cards' => [:optional, TrueClass]
        }]]
      },
      'cards' => [[{
        'x' => UNIT_REGEX,
        'y' => UNIT_REGEX,
        'rotate' => [
          :optional, Numeric,
          ClassyHash::G.enum(:clockwise, :counterclockwise, :turnaround),
          ROTATE_REGEX
        ],
        'flip_vertical' => [ :optional, FalseClass ],
        'flip_horizontal' => [ :optional, FalseClass ],
        }]]
    }.freeze
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
squib-0.15.2 lib/squib/sprues/sprue_schema.rb
squib-0.15.1 lib/squib/sprues/sprue_schema.rb