Sha256: 9b174bc1a2199f99b2d469ea55e82827483e4dd09a6d15f05bc7dfb539fba8fd
Contents?: true
Size: 933 Bytes
Versions: 3
Compression:
Stored size: 933 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, cell_px) if value == :solid @pattern = nil elsif value == :dotted @pattern = [ Args::UnitConversion.parse('0.2mm', dpi, cell_px), Args::UnitConversion.parse('0.5mm', dpi, cell_px) ] elsif value == :dashed @pattern = [ Args::UnitConversion.parse('2mm', dpi, cell_px), Args::UnitConversion.parse('2mm', dpi, cell_px) ] elsif value.is_a? String @pattern = value.split(' ').map do |val| Args::UnitConversion.parse val, dpi, cell_px end else raise ArgumentError, 'Unsupported dash style' end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
squib-0.19.0 | lib/squib/sprues/crop_line_dash.rb |
squib-0.19.0b | lib/squib/sprues/crop_line_dash.rb |
squib-0.19.0a | lib/squib/sprues/crop_line_dash.rb |