Sha256: 38c899da0d9a464ee4ee4ef2d0c225e6e9ed83a8a23f814ec073cf0fc7831e65
Contents?: true
Size: 914 Bytes
Versions: 6
Compression:
Stored size: 914 Bytes
Contents
module Squib module Sprues class CropLineDash VALIDATION_REGEX = /%r{ ^(\d*[.])?\d+(in|cm|mm) \s+ (\d*[.])?\d+(in|cm|mm)$ }x/ attr_reader :pattern def initialize(value, dpi) if value == :solid @pattern = nil elsif value == :dotted @pattern = [ Args::UnitConversion.parse('0.2mm', dpi), Args::UnitConversion.parse('0.5mm', dpi) ] elsif value == :dashed @pattern = [ Args::UnitConversion.parse('2mm', dpi), Args::UnitConversion.parse('2mm', dpi) ] elsif value.is_a? String @pattern = value.split(' ').map do |val| Args::UnitConversion.parse val, dpi end else raise ArgumentError, 'Unsupported dash style' end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems