Module: Undo

Defined in:
lib/undo.rb,
lib/undo/model.rb,
lib/undo/config.rb,
lib/undo/version.rb,
lib/undo/storage/memory.rb,
lib/undo/serializer/null.rb

Defined Under Namespace

Modules: Serializer, Storage Classes: Config, Model

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.configObject



11
12
13
# File 'lib/undo.rb', line 11

def self.config
  @config ||= Undo::Config.new
end

.configure(&block) ⇒ Object



7
8
9
# File 'lib/undo.rb', line 7

def self.configure(&block)
  block_given? ? block.call(config) : config
end

.restore(uuid, options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/undo.rb', line 19

def self.restore(uuid, options = {})
  config.with(options) do |config|
    config.serializer.deserialize config.storage.fetch uuid
  end
end

.wrap(object, *args) ⇒ Object



15
16
17
# File 'lib/undo.rb', line 15

def self.wrap(object, *args)
  Model.new object, *args
end