class Grape::Validations::ParamsScope::Attr

Attributes

key[RW]
scope[RW]

Public Class Methods

attr_key(declared_param_attr) click to toggle source
# File lib/grape/validations/params_scope.rb, line 34
def self.attr_key(declared_param_attr)
  return attr_key(declared_param_attr.key) if declared_param_attr.is_a?(self)

  if declared_param_attr.is_a?(Hash)
    declared_param_attr.transform_values { |value| attrs_keys(value) }
  else
    declared_param_attr
  end
end
attrs_keys(declared_params) click to toggle source

@return Array[Symbol, Hash[Symbol => Array]] declared_params with symbol instead of Attr

# File lib/grape/validations/params_scope.rb, line 28
def self.attrs_keys(declared_params)
  declared_params.map do |declared_param_attr|
    attr_key(declared_param_attr)
  end
end
new(key, scope) click to toggle source

Open up a new ParamsScope::Attr @param key [Hash, Symbol] key of attr @param scope [Grape::Validations::ParamsScope] scope of attr

# File lib/grape/validations/params_scope.rb, line 22
def initialize(key, scope)
  @key = key
  @scope = scope
end