Sha256: cea8f1f8909ca5df54605ae55445efbf12f0ef7ee19d6cb9ad1c97081b442335
Contents?: true
Size: 627 Bytes
Versions: 4
Compression:
Stored size: 627 Bytes
Contents
module Grape module Validations class AttributesIterator include Enumerable attr_reader :scope def initialize(validator, scope, params) @scope = scope @attrs = validator.attrs @params = Array.wrap(scope.params(params)) end 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 end end end
Version data entries
4 entries across 4 versions & 1 rubygems