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.
31 32 33 34 35 |
# File 'lib/grape/validations.rb', line 31 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
37 38 39 40 41 42 43 |
# File 'lib/grape/validations.rb', line 37 def each @params.each do |resource_params| @attrs.each do |attr_name| yield resource_params, attr_name end end end |