Sha256: f1f66ec94d8aee30b6ec9b26cbe05fc56c96b038cc799ed5210224d3ab4f8936
Contents?: true
Size: 597 Bytes
Versions: 20
Compression:
Stored size: 597 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
20 entries across 20 versions & 1 rubygems