Class: Grape::Validations::AttributesIterator
- Inherits:
-
Object
- Object
- Grape::Validations::AttributesIterator
- Includes:
- Enumerable
- Defined in:
- lib/grape/validations/attributes_iterator.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
- #each(&block) ⇒ 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.
10 11 12 13 14 15 |
# File 'lib/grape/validations/attributes_iterator.rb', line 10 def initialize(validator, scope, params) @scope = scope @attrs = validator.attrs @original_params = scope.params(params) @params = Array.wrap(@original_params) end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
8 9 10 |
# File 'lib/grape/validations/attributes_iterator.rb', line 8 def scope @scope end |
Instance Method Details
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/grape/validations/attributes_iterator.rb', line 17 def each(&block) do_each(@params, &block) # because we need recursion for nested arrays end |