Object
Base class for paginated lists.
Don't instantiate this class yourself. It's a base class extended by PhotoList and others.
# File lib/net/flickr/list.rb, line 52 def [](index) return @items[index] end
# File lib/net/flickr/list.rb, line 56 def each @items.each {|item| yield item } end
Returns true if the current page is the first page of the list, false otherwise.
# File lib/net/flickr/list.rb, line 62 def first_page? return @page == 1 end
Returns true if the current page is the last page of the list, false otherwise.
# File lib/net/flickr/list.rb, line 68 def last_page? return @page == @pages end
Loads the next page in the list.
# File lib/net/flickr/list.rb, line 73 def next if last_page? raise ListError, 'Already on the last page of the list' end @load_args['page'] = @page + 1 update_list end
Loads the specified page in the list.
# File lib/net/flickr/list.rb, line 83 def page=(page) if page < 1 || page > @pages raise ArgumentError, 'Page number out of bounds' end @load_args['page'] = page update_list end
Sets the number of items loaded per page. Must be between 1 and 500 inclusive.
# File lib/net/flickr/list.rb, line 94 def per_page=(per_page) if per_page < 1 || per_page > 500 raise ArgumentError, 'per_page must be between 1 and 500 inclusive' end @per_page = per_page @load_args['per_page'] = @per_page end
Loads the previous page in the list.
# File lib/net/flickr/list.rb, line 104 def previous if first_page? raise ListError, 'Already on the first page of the list' end @load_args['page'] = @page - 1 update_list end
Generated with the Darkfish Rdoc Generator 2.