lib/pycall/list.rb in pycall-0.1.0.alpha.20170307 vs lib/pycall/list.rb in pycall-0.1.0.alpha.20170308
- old
+ new
@@ -3,11 +3,11 @@
include PyObjectWrapper
include Enumerable
def self.new(init=nil)
case init
- when PyObject
+ when LibPython::PyObjectStruct
super
when nil
new(0)
when Integer
new(LibPython.PyList_New(init))
@@ -18,23 +18,9 @@
end
end
else
new(obj.to_ary)
end
- end
-
- def initialize(pyobj)
- super(pyobj, LibPython.PyList_Type)
- end
-
- def [](index)
- LibPython.PyList_GetItem(__pyobj__, index).to_ruby
- end
-
- def []=(index, value)
- value = Conversions.from_ruby(value)
- LibPython.PyList_SetItem(__pyobj__, index, value)
- value
end
def <<(value)
value = Conversions.from_ruby(value)
LibPython.PyList_Append(__pyobj__, value)