Module: WillPaginate::SequelMethods

Includes:
CollectionMethods
Defined in:
lib/will_paginate/sequel.rb

Overview

Sequel already supports pagination; we only need to make the resulting dataset look a bit more like WillPaginate::Collection

Instance Method Summary collapse

Methods included from CollectionMethods

#next_page, #previous_page

Instance Method Details

#offsetObject

Current offset of the paginated collection



33
34
35
# File 'lib/will_paginate/sequel.rb', line 33

def offset
  (current_page - 1) * per_page
end

#out_of_bounds?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/will_paginate/sequel.rb', line 28

def out_of_bounds?
  current_page > total_pages
end

#per_pageObject



15
16
17
# File 'lib/will_paginate/sequel.rb', line 15

def per_page
  page_size
end

#sizeObject Also known as: length



19
20
21
# File 'lib/will_paginate/sequel.rb', line 19

def size
  current_page_record_count
end

#total_entriesObject



24
25
26
# File 'lib/will_paginate/sequel.rb', line 24

def total_entries
  pagination_record_count
end

#total_pagesObject



11
12
13
# File 'lib/will_paginate/sequel.rb', line 11

def total_pages
  page_count
end