Class: Recursivar::Heap::Value
Instance Attribute Summary collapse
-
#callees ⇒ Object
readonly
Returns the value of attribute callees.
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #add_callee(callee, level) ⇒ Object
-
#initialize(obj) ⇒ Value
constructor
A new instance of Value.
- #inspect ⇒ Object
- #klass ⇒ Object
- #ref_instance_variables(heap) ⇒ Object
Constructor Details
#initialize(obj) ⇒ Value
Returns a new instance of Value.
8 9 10 11 12 |
# File 'lib/recursivar/heap.rb', line 8 def initialize(obj) @obj = obj @values = {} @callees = nil end |
Instance Attribute Details
#callees ⇒ Object (readonly)
Returns the value of attribute callees.
6 7 8 |
# File 'lib/recursivar/heap.rb', line 6 def callees @callees end |
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
6 7 8 |
# File 'lib/recursivar/heap.rb', line 6 def obj @obj end |
#values ⇒ Object (readonly)
Returns the value of attribute values.
6 7 8 |
# File 'lib/recursivar/heap.rb', line 6 def values @values end |
Instance Method Details
#add_callee(callee, level) ⇒ Object
32 33 34 |
# File 'lib/recursivar/heap.rb', line 32 def add_callee(callee, level) (@callees ||= {})[level] = callee end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/recursivar/heap.rb', line 14 def inspect @inspect ||= "#{klass}:#{@obj.object_id}" end |
#klass ⇒ Object
18 19 20 |
# File 'lib/recursivar/heap.rb', line 18 def klass @klass ||= @obj.class end |
#ref_instance_variables(heap) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/recursivar/heap.rb', line 22 def ref_instance_variables(heap) return if @referred @referred = true obj.instance_variables.each do |name| value = obj.instance_variable_get(name) @values[name] = heap.ref(value) end end |