Sha256: 27de553d126ee25fe9ddf6fba8d30d61fdf3c4d222d8b6ad8d1d5db70075197f

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

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.new(params: keys, message: message(:mutual_exclusion))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-1.6.0 lib/grape/validations/validators/mutual_exclusion.rb