Class: PyCall::GCGuard::Key
- Inherits:
-
Struct
- Object
- Struct
- PyCall::GCGuard::Key
- Defined in:
- lib/pycall/gc_guard.rb
Instance Attribute Summary collapse
-
#pyptr ⇒ Object
Returns the value of attribute pyptr.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(pyptr) ⇒ Key
constructor
A new instance of Key.
- #release ⇒ Object
Constructor Details
#initialize(pyptr) ⇒ Key
Returns a new instance of Key.
8 9 10 11 |
# File 'lib/pycall/gc_guard.rb', line 8 def initialize(pyptr) self.pyptr = check_pyptr(pyptr) # LibPython.Py_IncRef(pyptr) end |
Instance Attribute Details
#pyptr ⇒ Object
Returns the value of attribute pyptr
7 8 9 |
# File 'lib/pycall/gc_guard.rb', line 7 def pyptr @pyptr end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
18 19 20 21 22 23 24 25 |
# File 'lib/pycall/gc_guard.rb', line 18 def ==(other) case other when Key pyptr.pointer == other.pyptr.pointer else super end end |
#hash ⇒ Object
29 30 31 |
# File 'lib/pycall/gc_guard.rb', line 29 def hash pyptr.pointer.address end |
#release ⇒ Object
13 14 15 16 |
# File 'lib/pycall/gc_guard.rb', line 13 def release # LibPython.Py_DecRef(pyptr) self.pyptr = nil end |