Class: Undo::Keeper
- Inherits:
-
Object
- Object
- Undo::Keeper
- Extended by:
- Forwardable
- Defined in:
- lib/undo/keeper.rb
Instance Method Summary collapse
- #delete(uuid) ⇒ Object
-
#initialize(config, options) ⇒ Keeper
constructor
A new instance of Keeper.
- #restore(uuid) ⇒ Object
- #store(object) ⇒ Object
Constructor Details
#initialize(config, options) ⇒ Keeper
Returns a new instance of Keeper.
7 8 9 10 |
# File 'lib/undo/keeper.rb', line 7 def initialize(config, ) @config = config.with = config.filter end |
Instance Method Details
#delete(uuid) ⇒ Object
24 25 26 |
# File 'lib/undo/keeper.rb', line 24 def delete(uuid) storage.delete uuid, end |
#restore(uuid) ⇒ Object
19 20 21 22 |
# File 'lib/undo/keeper.rb', line 19 def restore(uuid) reflection = storage.fetch uuid, serializer.deserialize reflection, end |
#store(object) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/undo/keeper.rb', line 12 def store(object) build_uuid(object).tap do |uuid| reflection = serializer.serialize object, storage.store uuid, reflection, end end |