Class: WCC::Contentful::SimpleClient::PaginatingEnumerable
- Inherits:
-
Object
- Object
- WCC::Contentful::SimpleClient::PaginatingEnumerable
- Includes:
- Enumerable
- Defined in:
- lib/wcc/contentful/simple_client/response.rb
Instance Method Summary collapse
- #each {|page| ... } ⇒ Object
-
#initialize(initial_page) ⇒ PaginatingEnumerable
constructor
A new instance of PaginatingEnumerable.
Constructor Details
#initialize(initial_page) ⇒ PaginatingEnumerable
Returns a new instance of PaginatingEnumerable.
177 178 179 180 181 |
# File 'lib/wcc/contentful/simple_client/response.rb', line 177 def initialize(initial_page) raise ArgumentError, 'Must provide initial page' unless initial_page.present? @initial_page = initial_page end |
Instance Method Details
#each {|page| ... } ⇒ Object
183 184 185 186 187 188 189 190 191 |
# File 'lib/wcc/contentful/simple_client/response.rb', line 183 def each page = @initial_page yield page while page.next_page? page = page.next_page yield page end end |