Class: Windy::PaginatedCollection
- Includes:
- Enumerable, Finders
- Defined in:
- lib/windy.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #each_page ⇒ Object
-
#initialize ⇒ PaginatedCollection
constructor
A new instance of PaginatedCollection.
- #page(number) ⇒ Object
Methods included from Finders
#[], #method_missing, #respond_to?
Methods inherited from Base
#body, #inspect, #json, #prepare_request, root
Constructor Details
#initialize ⇒ PaginatedCollection
Returns a new instance of PaginatedCollection.
96 97 98 |
# File 'lib/windy.rb', line 96 def initialize @pages ||= {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Windy::Finders
Instance Method Details
#each(&block) ⇒ Object
114 115 116 117 118 |
# File 'lib/windy.rb', line 114 def each(&block) each_page do |page| page.each(&block) end end |
#each_page ⇒ Object
104 105 106 107 108 109 110 111 112 |
# File 'lib/windy.rb', line 104 def each_page number = 1 loop do page = self.page(number) break if page.count.zero? yield page number += 1 end end |