Class: Undo::Model

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/undo/model.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, options = {}) ⇒ Model

Returns a new instance of Model.



8
9
10
11
12
# File 'lib/undo/model.rb', line 8

def initialize(object, options = {})
  @object = object
  @config = config.with options
  super object
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



18
19
20
21
# File 'lib/undo/model.rb', line 18

def method_missing(method, *args, &block)
  store if config.mutator_methods.include? method
  super method, *args, &block
end

Instance Method Details

#uuidObject



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

def uuid
  @uuid ||= object.respond_to?(:uuid) ? object.uuid : generate_uuid
end