Sha256: 9824d998dfc995d2889f76048de9e096b2c1b8f21d292f894dbfbe171299c38b
Contents?: true
Size: 744 Bytes
Versions: 9
Compression:
Stored size: 744 Bytes
Contents
module GraphqlDevise module MountMethod module OptionSanitizers class ClassChecker def initialize(klass) @klass_array = Array(klass) end def call!(value, key) return if value.nil? unless value.instance_of?(Class) raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. Class expected." end unless @klass_array.any? { |klass| value.ancestors.include?(klass) } raise GraphqlDevise::InvalidMountOptionsError, "`#{key}` option has an invalid value. #{@klass_array.join(', ')} or descendants expected. Got #{value}." end value end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems