Object
The Pager class provides a simple wrapper around a paginated Sequel dataset.
Initializes a new Pager instance wrapping the given Sequel dataset and using url as the template for all generated URLs. url should be a string containing an sprintf flag (such as %s) in place of the page number.
# File lib/thoth/helper/pagination.rb, line 38 def initialize(dataset, url) @dataset = dataset @url = url end
Returns the number of the current page.
# File lib/thoth/helper/pagination.rb, line 44 def current_page @dataset.current_page end
Returns the number of records in the current page.
# File lib/thoth/helper/pagination.rb, line 49 def current_page_record_count @dataset.current_page_record_count end
Returns the record range for the current page.
# File lib/thoth/helper/pagination.rb, line 54 def current_page_record_range @dataset.current_page_record_range end
Returns the number of the next page or nil if the current page is the last.
# File lib/thoth/helper/pagination.rb, line 73 def next_page @dataset.next_page end
Returns the URL for the next page or nil if the current page is the last.
# File lib/thoth/helper/pagination.rb, line 79 def next_url next_page ? url(next_page) : nil end
Returns the total number of pages.
# File lib/thoth/helper/pagination.rb, line 84 def page_count @dataset.page_count end
Returns the page range.
# File lib/thoth/helper/pagination.rb, line 89 def page_range @dataset.page_range end
Returns the number of records per page.
# File lib/thoth/helper/pagination.rb, line 94 def page_size @dataset.page_size end
Returns the number of the previous page or nil if the current page is the first.
# File lib/thoth/helper/pagination.rb, line 100 def prev_page @dataset.prev_page end
Returns the URL for the previous page or nil if the current page is the first.
# File lib/thoth/helper/pagination.rb, line 106 def prev_url prev_page ? url(prev_page) : nil end
Generated with the Darkfish Rdoc Generator 2.