Sha256: 579bf092650854bb5a7599d8548ee04a1ee63cc639496038e8eaccdbc053eb4a
Contents?: true
Size: 742 Bytes
Versions: 9
Compression:
Stored size: 742 Bytes
Contents
module GraphqlDevise module MountMethod module OptionSanitizers class ArrayChecker def initialize(element_type) @element_type = element_type @default_value = [] end def call!(value, key) return @default_value if value.blank? unless value.instance_of?(Array) raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. Array expected." end unless value.all? { |element| element.instance_of?(@element_type) } raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has invalid elements. #{@element_type} expected." end value end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems