Sha256: 5f0236058db815e0d022bc000a3ce246a1e45b6977c7aa1090f10de8604a3f3e

Contents?: true

Size: 699 Bytes

Versions: 14

Compression:

Stored size: 699 Bytes

Contents

module Clever
  module APIOperations
    # Represents a list of results for a paged request.
    class ResultsList
      include Enumerable

      # Create a results list from a PageList
      # @api private
      # @return [ResultsList]
      def initialize(pagelist)
        @pages = pagelist
      end

      # Iterate over results list
      # @api public
      # @return [nil]
      # @example
      #   results = Clever::District.find # returns a ResultsList
      #   results.each do |district|
      #     puts district.name
      #   end
      def each
        @pages.each do |page|
          page.each do |elem|
            yield elem
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
clever-ruby-0.14.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.13.2 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.13.1 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.13.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.11.1 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.11.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.10.2 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.10.1 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.10.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.9.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.8.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.7.0 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.6.2 lib/clever-ruby/api_operations/results_list.rb
clever-ruby-0.6.1 lib/clever-ruby/api_operations/results_list.rb