Sha256: 5860708f960fb4d6d60a20a9be8345fdade8f29aaeb79afbb9c2139d475e271c
Contents?: true
Size: 754 Bytes
Versions: 6
Compression:
Stored size: 754 Bytes
Contents
require 'forwardable' class Page include Enumerable extend Forwardable def_delegators :@items, :each, :<< attr_reader :response, :items def initialize(response, key) @response = response @key = key @items = [] response.result[key].each do |item| @items << yield(item) end end def count meta :count end def page meta :page end def page_size meta :page_size end def page_count meta :page_count end def previous_page meta :previous_page end def next_page meta :next_page end def previous_page? previous_page != nil end def next_page? next_page != nil end private def meta(property) @response.result[:meta][@key][property] end end
Version data entries
6 entries across 6 versions & 1 rubygems