Module: Aws::PageableResponse::UnsafeEnumerableMethods Private
- Included in:
- Extension
- 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.
A handful of Enumerable methods, such as #count are not safe to call on a pageable response, as this would trigger n api calls simply to count the number of response pages, when likely what is wanted is to access count on the data. Same for #to_h.
Instance Method Summary collapse
- #as_json(_options = {}) ⇒ Object private
- #count ⇒ Object private
- #respond_to?(method_name, *args) ⇒ Boolean private
- #to_h ⇒ Object private
- #to_json(options = {}) ⇒ Object private
Instance Method Details
#as_json(_options = {}) ⇒ 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.
149 150 151 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 149 def as_json( = {}) data.to_h(data, as_json: true) end |
#count ⇒ 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.
129 130 131 132 133 134 135 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 129 def count if data.respond_to?(:count) data.count else raise NoMethodError, "undefined method `count'" end end |
#respond_to?(method_name, *args) ⇒ 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.
137 138 139 140 141 142 143 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 137 def respond_to?(method_name, *args) if method_name == :count data.respond_to?(:count) else super end end |
#to_h ⇒ 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.
145 146 147 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 145 def to_h data.to_h end |
#to_json(options = {}) ⇒ 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.
153 154 155 |
# File 'lib/aws-sdk-core/pageable_response.rb', line 153 def to_json( = {}) as_json.to_json() end |