class ComicVine::List
Enumerable list for multiple ComicVine
results @since 0.1.0
Attributes
cvos[R]
limit[R]
offset[R]
page_count[R]
total_count[R]
Public Class Methods
new(resp)
click to toggle source
# File lib/comicvine/list.rb, line 15 def initialize(resp) @total_count = resp['number_of_total_results'] @page_count = resp['number_of_page_results'] @offset = resp['offset'] @limit = resp['limit'] end
Public Instance Methods
each() { |c| ... }
click to toggle source
# File lib/comicvine/list.rb, line 22 def each @cvos.each { |c| yield c } end
has_more?()
click to toggle source
Returns if there are more pages to load @return [true, false] @since 0.1.3
# File lib/comicvine/list.rb, line 46 def has_more? self.total_pages > self.page ? true : false end
last()
click to toggle source
# File lib/comicvine/list.rb, line 26 def last @cvos.last end
page()
click to toggle source
Returns the current page the object is on @return [Integer]
# File lib/comicvine/list.rb, line 32 def page (self.offset / self.limit) + 1 end
total_pages()
click to toggle source
Returns the total number of pages available @return [Integer] Total number of pages @since 0.1.3
# File lib/comicvine/list.rb, line 39 def total_pages (self.total_count / self.limit) + 1 end
Protected Instance Methods
update_ivals(new_cvol)
click to toggle source
# File lib/comicvine/list.rb, line 52 def update_ivals(new_cvol) @total_count = new_cvol.total_count @offset = new_cvol.offset || 0 @limit = new_cvol.limit || 0 @cvos = new_cvol.cvos end