Class: Rod::ReferenceUpdater::IndexUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/rod/reference_updater.rb

Overview

This updater is used when there is an index of Rod objects and one of its keys is an object which is not yet stored. The key of the index is set to the rod_id, when the object is stored.

Instance Method Summary collapse

Constructor Details

#initialize(index) ⇒ IndexUpdater

The updater is initialized with the index to be updated.



56
57
58
# File 'lib/rod/reference_updater.rb', line 56

def initialize(index)
  @index = index
end

Instance Method Details

#update(object) ⇒ Object

Updates the index by providing the object with the updated rod_id.



61
62
63
# File 'lib/rod/reference_updater.rb', line 61

def update(object)
  @index.key_persisted(object)
end