class Undo::Keeper

Attributes

config[R]
options[R]

Public Class Methods

new(config, options) click to toggle source
# File lib/undo/keeper.rb, line 7
def initialize(config, options)
  @config = config.with options
  @options = config.filter options
end

Public Instance Methods

delete(uuid) click to toggle source
# File lib/undo/keeper.rb, line 24
def delete(uuid)
  storage.delete uuid, options
end
restore(uuid) click to toggle source
# File lib/undo/keeper.rb, line 19
def restore(uuid)
  reflection = storage.fetch uuid, options
  serializer.deserialize reflection, options
end
store(object) click to toggle source
# File lib/undo/keeper.rb, line 12
def store(object)
  build_uuid(object).tap do |uuid|
    reflection = serializer.serialize object, options
    storage.store uuid, reflection, options
  end
end

Private Instance Methods

build_uuid(object) click to toggle source
# File lib/undo/keeper.rb, line 32
def build_uuid(object)
  options[:uuid] || uuid_generator.call(object)
end