Class: ValueHolder

Inherits:
Object show all
Defined in:
lib/mega/snapshot.rb

Overview

Implements a value holder. In Wee this is useful for backtracking the reference assigned to an instance variable (not the object itself!). An example where this is used is the @__decoration attribute of class Wee::Component.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil) ⇒ ValueHolder

Returns a new instance of ValueHolder.



109
110
111
# File 'lib/mega/snapshot.rb', line 109

def initialize(value=nil)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



107
108
109
# File 'lib/mega/snapshot.rb', line 107

def value
  @value
end

Instance Method Details

#restore_snapshot(value) ⇒ Object



117
118
119
# File 'lib/mega/snapshot.rb', line 117

def restore_snapshot(value)
  @value = value
end

#take_snapshotObject



113
114
115
# File 'lib/mega/snapshot.rb', line 113

def take_snapshot
  @value
end