class PyBind::PyTuple
Public Class Methods
[](*ary)
click to toggle source
Make tuple from array
# File lib/pybind/types/tuple.rb, line 28 def self.[](*ary) new(ary) end
new(init)
click to toggle source
Calls superclass method
PyBind::PyObjectWrapper::new
# File lib/pybind/types/tuple.rb, line 10 def self.new(init) case init when PyObjectStruct super when Integer super(LibPython.PyTuple_New(init)) when Array tuple = new(init.size) init.each_with_index do |obj, index| tuple[index] = obj end tuple else raise TypeError, "the argument must be an Integer, a PyObjectStruct or a Array" end end
Public Instance Methods
[](index)
click to toggle source
# File lib/pybind/types/tuple.rb, line 36 def [](index) LibPython.PyTuple_GetItem(@pystruct, index).to_ruby end
[]=(index, value)
click to toggle source
# File lib/pybind/types/tuple.rb, line 40 def []=(index, value) value = value.to_python LibPython.PyTuple_SetItem(@pystruct, index, value) end
size()
click to toggle source
# File lib/pybind/types/tuple.rb, line 32 def size LibPython.PyTuple_Size(@pystruct) end