Class: Shared::Collection Abstract

Inherits:
Resource show all
Includes:
Enumerable
Defined in:
lib/vas/shared/collection.rb

Overview

This class is abstract.

A dynamic collection of items

Instance Attribute Summary

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client, type, entry_class) ⇒ Collection

Returns a new instance of Collection.



31
32
33
34
35
# File 'lib/vas/shared/collection.rb', line 31

def initialize(location, client, type, entry_class)
  @type = type
  @entry_class = entry_class
  super(location, client)
end

Instance Method Details

#each {|item| ... } ⇒ void

This method returns an undefined value.

Calls the block once for each item in the collection.

Yield Parameters:

  • item

    an item in the collection



47
48
49
50
# File 'lib/vas/shared/collection.rb', line 47

def each
  @items ||= create_collection_entries
  @items.each { |item| yield item }
end

#reloadObject



37
38
39
40
# File 'lib/vas/shared/collection.rb', line 37

def reload
  super
  @items = nil
end