Class: Undo::Model

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Model.



3
4
5
6
7
# File 'lib/undo/model.rb', line 3

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



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

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

Instance Method Details

#uuidObject



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

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