Class: Fog::PagedCollection

Inherits:
Collection show all
Defined in:
lib/fog/core/collection.rb

Overview

Base class for collection classes whose ‘all’ method returns only a single page of results and passes the ‘Marker’ option along as self.filters

Direct Known Subclasses

AWS::RDS::InstanceOptions

Instance Attribute Summary

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#each(filters = filters) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/fog/core/collection.rb', line 148

def each(filters=filters)
  if block_given?
    begin
      page = self.all(filters)
      # We need to explicitly use the base 'each' method here on the page, otherwise we get infinite recursion
      base_each = Fog::Collection.instance_method(:each)
      base_each.bind(page).call { |item| yield item }
    end while self.filters[:marker]
  end
  self
end