class SRL::ResultSet

Wrapper around various calls to paginated data, such as past races. Contains pagination information, and information on all records, on top of the current page's records.

Attributes

count[R]

Total number of records matching the query for this result set.

data[R]

Records for this result set.

NOTE

Always an array, though the type of object contained in the array can vary depending on the query that spawned it.

items[R]

Records for this result set.

NOTE

Always an array, though the type of object contained in the array can vary depending on the query that spawned it.

num_records[R]

Total number of records matching the query for this result set.

page[R]

The page of this result set.

page_size[R]
per_page[R]
records[R]

Records for this result set.

NOTE

Always an array, though the type of object contained in the array can vary depending on the query that spawned it.

results[R]

Records for this result set.

NOTE

Always an array, though the type of object contained in the array can vary depending on the query that spawned it.

total_records[R]

Total number of records matching the query for this result set.

Public Class Methods

new(results, params = {}) click to toggle source
# File lib/srl/result_set.rb, line 26
def initialize(results, params = {})
  @results = results
  @page = params.fetch(:page)
  @page_size = params.fetch(:page_size)
  @count = params.fetch(:count)
end

Public Instance Methods

last_page?() click to toggle source
# File lib/srl/result_set.rb, line 38
def last_page?
  page == num_pages
end
num_pages() click to toggle source
# File lib/srl/result_set.rb, line 33
def num_pages
  (count.to_f / page_size.to_f).ceil
end
Also aliased as: pages
pages()
Alias for: num_pages