module ElasticSearch::Api::Pagination

Public Instance Methods

current_page() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 21
def current_page
  (@options[:page].respond_to?(:empty?) ? @options[:page].empty? : !@options[:page]) ? 1 : @options[:page].to_i
end
next_page() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 25
def next_page
  current_page >= total_pages ? nil : current_page + 1
end
page_count()
Alias for: total_pages
per_page() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 33
def per_page
  @options[:per_page] || 10
end
previous_page() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 29
def previous_page
  current_page == 1 ? nil : current_page - 1
end
total_pages() click to toggle source
# File lib/elasticsearch/client/hits.rb, line 37
def total_pages
  (total_entries / per_page.to_f).ceil
end
Also aliased as: page_count