Class: Undo::Wrapper
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Undo::Wrapper
- Extended by:
- Forwardable
- Defined in:
- lib/undo/wrapper.rb
Instance Attribute Summary collapse
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(object, options = {}) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(object, options = {}) ⇒ Wrapper
Returns a new instance of Wrapper.
9 10 11 12 13 14 15 16 |
# File 'lib/undo/wrapper.rb', line 9 def initialize(object, = {}) @object = object @mutator_methods = .delete(:mutator_methods) || [] @uuid = object.respond_to?(:uuid) ? object.uuid : .fetch(:uuid) @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/wrapper.rb', line 18 def method_missing(method, *args, &block) store if mutator_methods.include? method super method, *args, &block end |
Instance Attribute Details
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
7 8 9 |
# File 'lib/undo/wrapper.rb', line 7 def uuid @uuid end |