def cast(value, context, reconstantize: true, convert: true)
      @klass ||= klass

      if matches?(value)
        value
      elsif reconstantize
        @klass = klass
        public_send(__method__, value, context,
          reconstantize: false,
          convert: convert
        )
      elsif !value.nil? && convert
        finder = options.fetch(:finder, :find)
        value = find(klass, value, finder)
        public_send(__method__, value, context,
          reconstantize: reconstantize,
          convert: false
        )
      else
        super(value, context)
      end
    end
def cast(value, context, reconstantize: true, convert: true)
      @klass ||= klass

      if matches?(value)
        value
      elsif reconstantize
        @klass = klass
        public_send(__method__, value, context,
          reconstantize: false,
          convert: convert
        )
      elsif !value.nil? && convert
        finder = options.fetch(:finder, :find)
        value = find(klass, value, finder)
        public_send(__method__, value, context,
          reconstantize: reconstantize,
          convert: false
        )
      else
        super(value, context)
      end
    end
rubocop:disable Metrics/MethodLength