class Fog::AWS::IAM::PagedCollection
Public Class Methods
inherited(klass)
click to toggle source
Calls superclass method
# File lib/fog/aws/iam/paged_collection.rb, line 5 def self.inherited(klass) klass.send(:attribute, :truncated, :aliases => 'IsTruncated', :type => :boolean) klass.send(:attribute, :marker, :aliases => 'Marker') super end
Public Instance Methods
each(options={}) { |f| ... }
click to toggle source
# File lib/fog/aws/iam/paged_collection.rb, line 16 def each(options={}) limit = options[:limit] || 100 if !block_given? self else subset = dup.all subset.each_entry { |f| yield f } while subset.truncated subset. all(:marker => subset.marker, :limit => limit). each_entry { |f| yield f } end self end end
each_entry(*args, &block)
click to toggle source
# File lib/fog/aws/iam/paged_collection.rb, line 12 def each_entry(*args, &block) to_a.each(*args, &block) end
Protected Instance Methods
page_params(options={})
click to toggle source
# File lib/fog/aws/iam/paged_collection.rb, line 38 def page_params(options={}) marker = options.fetch(:marker) { options.fetch('Marker') { self.marker } } limit = options.fetch(:limit) { options['MaxItems'] } params = {} if marker && !marker.empty? params.merge!('Marker' => marker) end if limit params.merge!('MaxItems' => limit) end params end