Module: PolyglotFlutter::Helper::Depaginate

Included in:
Resource::Base
Defined in:
lib/flutter_polyglot_cli/helpers/depaginate.rb

Constant Summary collapse

PER_PAGE =
100

Instance Method Summary collapse

Instance Method Details

#depaginate_query(query) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/flutter_polyglot_cli/helpers/depaginate.rb', line 6

def depaginate_query(query)
  depaginated_array = []
  page = query.page(1).per(PER_PAGE).all
  until page.nil?
    depaginated_array += page
    page = page.pages.next
  end
  depaginated_array
end