Sha256: 2642cff2968aaf21e70d4a69befe0e0e942699c99d91a5b8e516863cf163d0c5

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

module Grape
  module Validations
    class MultipleParamsBase < Base
      attr_reader :scoped_params

      def validate!(params)
        @scoped_params = [@scope.params(params)].flatten
        params
      end

      private

      def scope_requires_params
        @scope.required? || scoped_params.any?(&:any?)
      end

      def keys_in_common(resource_params)
        (all_keys & resource_params.stringify_keys.keys).map(&:to_s)
      end

      def all_keys
        attrs.map(&:to_s)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-0.11.0 lib/grape/validations/validators/multiple_params_base.rb
grape-0.10.1 lib/grape/validations/validators/multiple_params_base.rb
grape-0.10.0 lib/grape/validations/validators/multiple_params_base.rb