Sha256: a1354556f66fe6acb59f5c97e1ca5ebb0a505843453f41e1e35ba1bfd01e2bf6
Contents?: true
Size: 499 Bytes
Versions: 5
Compression:
Stored size: 499 Bytes
Contents
# typed: strict # frozen_string_literal: true module DearInventory module Validators class Required < DearInventory::Validator extend T::Sig sig { override.void } def call return if present?(instance_variable_get(:@value)) raise_error("the field is required but no value was provided") end private def present?(value) !blank?(value) end def blank?(value) value&.empty? || !value end end end end
Version data entries
5 entries across 5 versions & 1 rubygems