Class: Aws::Record::ItemCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/aws-record/record/item_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(search_method, search_params, model, client) ⇒ ItemCollection

Returns a new instance of ItemCollection.



19
20
21
22
23
24
# File 'lib/aws-record/record/item_collection.rb', line 19

def initialize(search_method, search_params, model, client)
  @search_method = search_method
  @search_params = search_params
  @model = model
  @client = client
end

Instance Method Details

#each(&block) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/aws-record/record/item_collection.rb', line 26

def each(&block)
  return enum_for(:each) unless block_given?
  items.each_page do |page|
    items_array = _build_items_from_response(page.items, @model)
    items_array.each do |item|
      yield item
    end
  end
end

#empty?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/aws-record/record/item_collection.rb', line 36

def empty?
  items.empty?
end