module PyBind::PyObjectClassMethods
Public Instance Methods
from_python(pystruct)
click to toggle source
# File lib/pybind/wrapper.rb, line 29 def from_python(pystruct) new(pystruct) end
pybind_type(pytype, &block)
click to toggle source
# File lib/pybind/wrapper.rb, line 7 def pybind_type(pytype, &block) raise ArgumentError, "#{self} is already bound with #{@pystruct}" if @pystruct define_singleton_method :from_python, &block if block @pystruct = pytype.to_python_struct end
python_instance?(pyobj)
click to toggle source
# File lib/pybind/wrapper.rb, line 13 def python_instance?(pyobj) return false unless @pystruct pystruct = pyobj.to_python_struct value = LibPython.PyObject_IsInstance(pystruct, @pystruct) raise PyError.fetch if value == -1 value == 1 end
python_subclass?(pyobj)
click to toggle source
# File lib/pybind/wrapper.rb, line 21 def python_subclass?(pyobj) return false unless @pystruct pystruct = pyobj.to_python_struct value = LibPython.PyObject_IsSubclass(pystruct, @pystruct) raise PyError.fetch if value == -1 value == 1 end
to_python_struct()
click to toggle source
# File lib/pybind/wrapper.rb, line 33 def to_python_struct @pystruct end
Also aliased as: python_type, to_python