Sha256: 1eb201a109f7a4703aec76996020121d7af0bbb287c2adc50c150a15c3125885

Contents?: true

Size: 475 Bytes

Versions: 5

Compression:

Stored size: 475 Bytes

Contents

module Grape
  module Validations
    class AttributesIterator
      include Enumerable

      def initialize(validator, scope, params)
        @attrs = validator.attrs
        @params = scope.params(params)
        @params = (@params.is_a?(Array) ? @params : [@params])
      end

      def each
        @params.each do |resource_params|
          @attrs.each do |attr_name|
            yield resource_params, attr_name
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-0.13.0 lib/grape/validations/attributes_iterator.rb
grape-0.12.0 lib/grape/validations/attributes_iterator.rb
grape-0.11.0 lib/grape/validations/attributes_iterator.rb
grape-0.10.1 lib/grape/validations/attributes_iterator.rb
grape-0.10.0 lib/grape/validations/attributes_iterator.rb