Sha256: 54b18b9896d575c1f9d0a3ed92c2c063d7377ce2c7dd6e8b45e4da03e164ee50
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 Bytes
Contents
# typed: strict # frozen_string_literal: true module DearInventory module Validators class Guid < DearInventory::Validator extend T::Sig REGEX = T.let( [ /\A[\da-f]{32}\z/i, /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i ].freeze, T::Array[Regexp] ) sig { override.void } def call value = instance_variable_get(:@value) return if value.nil? return if REGEX.any? { |regex| value =~ regex } raise_error("#{value.inspect} is not a valid GUID") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dear_inventory-0.2.0 | lib/dear_inventory/validators/guid.rb |