Sha256: 41da9c1bdc8db5fd8d25464a2c1d83ddbf6172c070356d403d540e784e964585

Contents?: true

Size: 382 Bytes

Versions: 3

Compression:

Stored size: 382 Bytes

Contents

require 'grape/validations/validators/multiple_params_base'

module Grape
  module Validations
    class MutualExclusionValidator < MultipleParamsBase
      def validate_params!(params)
        keys = keys_in_common(params)
        return if keys.length <= 1
        raise Grape::Exceptions::Validation, params: keys, message: message(:mutual_exclusion)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/validations/validators/mutual_exclusion.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/validations/validators/mutual_exclusion.rb
grape-1.2.5 lib/grape/validations/validators/mutual_exclusion.rb