Module: Aws::PageableResponse::Extension Private
- Includes:
- UnsafeEnumerableMethods, Enumerable
- Defined in:
- lib/aws-sdk-core/pageable_response.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
The actual decorator module implementation. It is in a distinct module so that it can be used to extend objects without busting Ruby’s constant cache. object.extend(mod) bust the constant cache only if mod contains constants of its own.
Instance Attribute Summary collapse
- #pager ⇒ Object private
Instance Method Summary collapse
- #each {|response| ... } ⇒ Object (also: #each_page) private
- #last_page? ⇒ Boolean private
- #next_page(params = {}) ⇒ Object private
- #next_page? ⇒ Boolean private
Methods included from UnsafeEnumerableMethods
#as_json, #count, #respond_to?, #to_h, #to_json
Instance Attribute Details
#pager ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
167 168 169 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 167 def pager @pager end |
Instance Method Details
#each {|response| ... } ⇒ Object Also known as: each_page
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
188 189 190 191 192 193 194 195 196 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 188 def each(&block) return enum_for(:each_page) unless block_given? response = self yield(response) until response.last_page? response = response.next_page yield(response) end end |
#last_page? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
169 170 171 172 173 174 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 169 def last_page? if @last_page.nil? @last_page = !@pager.truncated?(self) end @last_page end |
#next_page(params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
180 181 182 183 184 185 186 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 180 def next_page(params = {}) if last_page? raise LastPageError.new(self) else next_response(params) end end |
#next_page? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
176 177 178 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 176 def next_page? !last_page? end |