Sha256: c4d4a3d2b2b0e4adca7802fb5a73082c9bd230541c7a6f39e63758aac71a9d31
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
class Object def to_python_struct raise TypeError, "can not convert #{inspect} to a PyObjectStruct" end alias_method :to_python, :to_python_struct end class NilClass def to_python PyBind::LibPython.Py_None end end class TrueClass def to_python PyBind::LibPython.Py_True end end class FalseClass def to_python PyBind::LibPython.Py_False end end class Integer def to_python PyBind::LibPython.PyInt_FromSsize_t(self) end end class Float def to_python PyBind::LibPython.PyFloat_FromDouble(self) end end class String def to_python case encoding when Encoding::US_ASCII, Encoding::BINARY PyBind::LibPython.PyString_FromStringAndSize(self, bytesize) else utf8_str = encode(Encoding::UTF_8) PyBind::LibPython.PyUnicode_DecodeUTF8(utf8_str, utf8_str.bytesize, nil) end end end class Symbol def to_python to_s.to_python end end class Hash def to_python PyBind::PyDict.new(self).to_python_struct end end class Array def to_python PyBind::PyList.new(self).to_python_struct end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pybind-0.1.0 | lib/pybind/core_ext/basic.rb |