Sha256: c7c0f45c828ea35bf2e2b01cf4e58ce8fa650b872bad062aeb5aadd5c903e704
Contents?: true
Size: 414 Bytes
Versions: 1
Compression:
Stored size: 414 Bytes
Contents
# frozen_string_literal: true require 'active_model' class TypeValidator class ByArrayWith def self.invalid?(value, options) expected = options[:array_with] raise ArgumentError, "#{expected} must be an array" unless expected.is_a?(Array) return if value.is_a?(Array) && !value.empty? && (value - expected).empty? "must be an array with: #{expected.join(', ')}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
type_validator-0.7.0 | lib/type_validator/by_array_with.rb |