Class: RMXWeakHolder
- Inherits:
-
Object
- Object
- RMXWeakHolder
- Defined in:
- lib/motion/RMXWeakHolder.rb
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(_value = nil) ⇒ RMXWeakHolder
constructor
A new instance of RMXWeakHolder.
- #inspect ⇒ Object
- #value ⇒ Object
- #value=(_value) ⇒ Object
Constructor Details
#initialize(_value = nil) ⇒ RMXWeakHolder
Returns a new instance of RMXWeakHolder.
3 4 5 6 7 8 |
# File 'lib/motion/RMXWeakHolder.rb', line 3 def initialize(_value=nil) @value_desc = _value.rmx_object_desc @holder = NSHashTable.weakObjectsHashTable self.value = _value self end |
Instance Method Details
#eql?(other) ⇒ Boolean
24 25 26 |
# File 'lib/motion/RMXWeakHolder.rb', line 24 def eql?(other) other.hash == value.hash end |
#hash ⇒ Object
20 21 22 |
# File 'lib/motion/RMXWeakHolder.rb', line 20 def hash value.hash end |
#inspect ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/motion/RMXWeakHolder.rb', line 28 def inspect if val = value "(weak)#{@value_desc}" else "(deallocated)#{@value_desc}" end end |
#value ⇒ Object
10 11 12 |
# File 'lib/motion/RMXWeakHolder.rb', line 10 def value @holder.anyObject end |
#value=(_value) ⇒ Object
14 15 16 17 18 |
# File 'lib/motion/RMXWeakHolder.rb', line 14 def value=(_value) @holder.removeAllObjects @holder.addObject(_value) unless _value.nil? _value end |