class Elasticord::Client::ArrayWithMetaData
Attributes
current_page[RW]
per_page[RW]
total_count[RW]
total_results[RW]
Public Class Methods
new(page_default, per_page_default)
click to toggle source
Calls superclass method
# File lib/elasticord/client/array_with_meta_data.rb, line 6 def initialize(page_default, per_page_default) @internal_array = [] @per_page = per_page_default @current_page = page_default @total_results = 0 super(@internal_array) end
Public Instance Methods
from()
click to toggle source
# File lib/elasticord/client/array_with_meta_data.rb, line 26 def from (current_page - 1) * size end
size()
click to toggle source
# File lib/elasticord/client/array_with_meta_data.rb, line 22 def size per_page end
total_pages()
click to toggle source
# File lib/elasticord/client/array_with_meta_data.rb, line 18 def total_pages (total_results / per_page.to_f).ceil end