module PyBind::TypeCast

Public Class Methods

from_python(pyobj) click to toggle source
# File lib/pybind/typecast.rb, line 3
def self.from_python(pyobj)
  pystruct = pyobj.to_python_struct
  return nil if pystruct.null? || pystruct.none?

  Types.pytypes.each do |pytype|
    return pytype.from_python(pystruct) if pytype.python_instance?(pystruct)
  end
  PyObject.from_python(pystruct)
end
to_python_arguments(indices) click to toggle source
# File lib/pybind/typecast.rb, line 13
def self.to_python_arguments(indices)
  if indices.length == 1
    indices = indices[0]
  else
    indices = PyTuple.new(indices)
  end
  indices.to_python
end