Sha256: 76f6004f414426a97992475aab88c391279549aca2d6fa3a6a2a1d6e485bb4ef
Contents?: true
Size: 513 Bytes
Versions: 3
Compression:
Stored size: 513 Bytes
Contents
# frozen_string_literal: true module Grape module Validations module Validators class ExactlyOneOfValidator < MultipleParamsBase def validate_params!(params) keys = keys_in_common(params) return if keys.length == 1 raise Grape::Exceptions::Validation.new(params: all_keys, message: message(:exactly_one)) if keys.empty? raise Grape::Exceptions::Validation.new(params: keys, message: message(:mutual_exclusion)) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems