Class: Grape::Validations::Validator::AttributesIterator
- Inherits:
-
Object
- Object
- Grape::Validations::Validator::AttributesIterator
- Includes:
- Enumerable
- Defined in:
- lib/grape/validations.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(validator, scope, params) ⇒ AttributesIterator
constructor
A new instance of AttributesIterator.
Constructor Details
#initialize(validator, scope, params) ⇒ AttributesIterator
Returns a new instance of AttributesIterator.
27 28 29 30 31 |
# File 'lib/grape/validations.rb', line 27 def initialize(validator, scope, params) @attrs = validator.attrs @params = scope.params(params) @params = (@params.is_a?(Array) ? @params : [@params]) end |
Instance Method Details
#each ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/grape/validations.rb', line 33 def each @params.each do |resource_params| @attrs.each do |attr_name| yield resource_params, attr_name end end end |