Class: PyBind::PySlice
- Includes:
- PyObjectWrapper
- Defined in:
- lib/pybind/types/slice.rb
Constant Summary
Constants included from Operator
Operator::BINARY_OPERATION_OPFUNCS, Operator::UNARY_OPERATION_OPFUNCS
Constants included from RichComparer
RichComparer::Py_EQ, RichComparer::Py_GE, RichComparer::Py_GT, RichComparer::Py_LE, RichComparer::Py_LT, RichComparer::Py_NE, RichComparer::RICH_COMPARISON_OPCODES
Class Method Summary collapse
Methods included from PyObjectWrapper
#autocall_method_missing, #call, included, #initialize, #inspect, #methods, #python_type, #to_python_struct, #to_s
Methods included from Operator
#!, #**, #<=>, #===, #__binary_operate__, #__unary_operate__
Methods included from RichComparer
Methods included from AttrAccessor
#[], #[]=, #get_attribute, #has_attribute?, #remove_attribute, #set_attribute
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PyBind::PyObjectWrapper
Class Method Details
.new(start, stop = nil, step = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/pybind/types/slice.rb', line 6 def self.new(start, stop = nil, step = nil) if stop.nil? && step.nil? start, stop = nil, start return super(stop) if stop.kind_of?(PyObjectStruct) end start = start ? start.to_python : PyObjectStruct.null stop = stop ? stop.to_python : PyObjectStruct.null step = step ? step.to_python : PyObjectStruct.null pyobj = LibPython.PySlice_New(start, stop, step) raise PyError.fetch if pyobj.null? pyobj.to_ruby end |