Sha256: 0d6f6327ed61458c505d7f6b2b6902c42cb32e4e39be4753ac840f7ecccd157e
Contents?: true
Size: 524 Bytes
Versions: 1
Compression:
Stored size: 524 Bytes
Contents
# typed: strict # frozen_string_literal: true module DearInventory module Validators class Enum < DearInventory::Validator extend T::Sig sig { override.void } def call value = instance_variable_get(:@value) return if value.nil? return if T.must(@values).include?(value) raise_error( "expected one of " \ "#{T.must(@values).map { |val| val.inspect }.join(", ")} " \ "but received #{value.inspect}" ) 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/enum.rb |