Sha256: d93bdb05003d108e7bb06a6db76b097c813789b05f67f83c1f2b6c8626c41970

Contents?: true

Size: 359 Bytes

Versions: 10

Compression:

Stored size: 359 Bytes

Contents

# frozen_string_literal: true

module Grape
  module Validations
    class PresenceValidator < Base
      def validate_param!(attr_name, params)
        return if params.respond_to?(:key?) && params.key?(attr_name)
        raise Grape::Exceptions::Validation.new(params: [@scope.full_name(attr_name)], message: message(:presence))
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
grape-1.5.3 lib/grape/validations/validators/presence.rb
grape-1.5.2 lib/grape/validations/validators/presence.rb
grape-1.5.1 lib/grape/validations/validators/presence.rb
grape-1.5.0 lib/grape/validations/validators/presence.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/validations/validators/presence.rb
grape-1.4.0 lib/grape/validations/validators/presence.rb
grape-1.3.3 lib/grape/validations/validators/presence.rb
grape-1.3.2 lib/grape/validations/validators/presence.rb
grape-1.3.1 lib/grape/validations/validators/presence.rb
grape-1.3.0 lib/grape/validations/validators/presence.rb