Module: Highrise::Pagination::ClassMethods

Defined in:
lib/highrise/pagination.rb

Instance Method Summary collapse

Instance Method Details

#each(options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/highrise/pagination.rb', line 14

def each(options = {})
  options[:params] ||= {}
  options[:params][:n] = 0

  loop do
    if (records = self.find(:all, options)).any?
      records.each { |record| yield record }
      options[:params][:n] += records.size
    else
      break # no people included on that page, thus no more people total
    end
  end
end

#find_all_across_pages(options = {}) ⇒ Object



8
9
10
11
12
# File 'lib/highrise/pagination.rb', line 8

def find_all_across_pages(options = {})
  records = []
  each(options) { |record| records << record }
  records
end