Method: PyBind::PyTuple.new
- Defined in:
- lib/pybind/types/tuple.rb
.new(init) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# 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 |