class Grape::Validations::AttributesIterator
Attributes
scope[R]
Public Class Methods
new(validator, scope, params)
click to toggle source
# File lib/grape/validations/attributes_iterator.rb, line 8 def initialize(validator, scope, params) @scope = scope @attrs = validator.attrs @params = Array.wrap(scope.params(params)) end
Public Instance Methods
each() { |resource_params, attr_name| ... }
click to toggle source
# File lib/grape/validations/attributes_iterator.rb, line 14 def each @params.each do |resource_params| @attrs.each_with_index do |attr_name, index| if resource_params.is_a?(Hash) && resource_params[attr_name].is_a?(Array) scope.index = index end yield resource_params, attr_name end end end