Class: DataMapper::LoadedSet::ObjectIdCollection

Inherits:
Object
  • Object
show all
Includes:
Support::Enumerable, Enumerable
Defined in:
lib/data_mapper/loaded_set.rb

Overview

Not sure if this is necessary yet… In other words: Does it make sense to allow portions of a set to be garbage-collected?

If so, then this isn’t good enough because it’s likely to throw errors. If it’s not, then letting Ruby itself track the references with a simple Array is probably more effecient.

Instance Method Summary collapse

Methods included from Support::Enumerable

#group_by

Constructor Details

#initializeObjectIdCollection

Returns a new instance of ObjectIdCollection.



31
32
33
# File 'lib/data_mapper/loaded_set.rb', line 31

def initialize
  @object_ids = []
end

Instance Method Details

#<<(object) ⇒ Object



39
40
41
# File 'lib/data_mapper/loaded_set.rb', line 39

def <<(object)
  @object_ids << object.object_id
end

#eachObject



35
36
37
# File 'lib/data_mapper/loaded_set.rb', line 35

def each
  @object_ids.map { |id| yield ObjectSpace::_id2ref(id) }
end