Sha256: 2a16aaa65b93a8fed5aedf962d8ee717443360a5dc317ddc5cf39287ad097a1d
Contents?: true
Size: 692 Bytes
Versions: 2
Compression:
Stored size: 692 Bytes
Contents
module GH class Pagination < Wrapper class Paginated include Enumerable def initialize(page, url, gh) @page, @next_url, @gh = page, url, gh end def each(&block) return enum_for(:each) unless block @page.each(&block) next_page.each(&block) end def inspect "[#{first.inspect}, ...]" end private def next_page @next_page ||= @gh[@next_url] end end wraps GH::Normalizer double_dispatch def modify_response(response) return response unless response.headers['link'] =~ /<([^>]+)>;\s*rel=\"next\"/ Paginated.new(response, $1, self) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gh-0.4.1 | lib/gh/pagination.rb |
gh-0.4.0 | lib/gh/pagination.rb |