class String

Public Instance Methods

to_python() click to toggle source
# File lib/pybind/core_ext/basic.rb, line 39
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