Method: DataMapper::OrderedSet::Cache::API#delete

Defined in:
lib/dm-core/support/ordered_set.rb

#delete(entry) ⇒ API

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delete an entry from the cache

Parameters:

  • entry (Object)

    the entry to delete from the cache

Returns:

  • (API)

    self



141
142
143
144
145
146
147
148
149
# File 'lib/dm-core/support/ordered_set.rb', line 141

def delete(entry)
  deleted_index = @cache.delete(key_for(entry))
  if deleted_index
    @cache.each do |key, index|
      @cache[key] -= 1 if index > deleted_index
    end
  end
  deleted_index
end