Sha256: 9b4d78a78fc19ffa58f9e23ea03902a3f1fd5d66600462da13f1221d238e07cc
Contents?: true
Size: 775 Bytes
Versions: 18
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true 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
18 entries across 18 versions & 1 rubygems