Class Grape::Validations::ParamsScope
In: lib/grape/validations/params_scope.rb
Parent: Object

Methods

Included Modules

Grape::DSL::Parameters

Attributes

element  [RW] 
index  [RW] 
parent  [RW] 
type  [R] 

Public Class methods

Open up a new ParamsScope, allowing parameter definitions per

  Grape::DSL::Params.

@param opts [Hash] options for this scope @option opts :element [Symbol] the element that contains this scope; for

  this to be relevant, @parent must be set

@option opts :parent [ParamsScope] the scope containing this scope @option opts :api [API] the API endpoint to modify @option opts :optional [Boolean] whether or not this scope needs to have

  any parameters set or not

@option opts :type [Class] a type meant to govern this scope (deprecated) @option opts :type [Hash] group options for this scope @option opts :dependent_on [Symbol] if present, this scope should only

  validate if this param is present in the parent scope

@yield the instance context, open for parameter definitions

Public Instance methods

@return [String] the proper attribute name, with nesting considered.

A lateral scope is subordinate to its parent, but its keys are at the same level as its parent and thus is not contained within an element. @return [Boolean] whether or not this scope is lateral

A nested scope is contained in one of its parent‘s elements. @return [Boolean] whether or not this scope is nested

@return [Boolean] whether or not this scope needs to be present, or can

  be blank

@return [Boolean] whether or not this scope is the root-level scope

@return [Boolean] whether or not this entire scope needs to be

  validated

Protected Instance methods

Adds a parameter declaration to our list of validations. @param attrs [Array] (see Grape::DSL::Parameters#requires)

[Validate]