Sha256: 13aef131254ef591360512f96a60cef89d0494027f7c9b0b18aa91f329d013f5
Contents?: true
Size: 558 Bytes
Versions: 10
Compression:
Stored size: 558 Bytes
Contents
module GS1 module Validations # Ensures correct length validation. # module LengthValidation def validate_length errors << 'Invalid length' unless valid_length? end def valid_length? return false unless data valid_barcode_length? || valid_allowed_length? end def valid_allowed_length? self.class.allowed_lengths.include?(data.size) end def valid_barcode_length? self.class.barcode_length == data.size if self.class.barcode_length end end end end
Version data entries
10 entries across 10 versions & 1 rubygems