class Crython::PyObject

Overview

Extension methods for PyObject

Included Modules

Defined in:

crython/py2cr/basic.cr
crython/py2cr/collections.cr
crython/pyobject.cr

Constructors

Macro Summary

Instance Method Summary

Instance methods inherited from module Crython::ObjectProtocol

<=>(other : ObjectProtocol) <=>, attr(attr : String) : PyObject attr, callable? : Bool callable?, del_attr(attr : String) : Bool del_attr, has_attr?(attr : String) : Bool has_attr?, set_attr(attr : String, obj : ObjectMethods) set_attr, to_unsafe to_unsafe

Constructor Detail

def self.new(raw : LibPython::PyObject, need_decref : Bool = false) #

[View source]

Macro Detail

macro method_missing(call) #

[View source]

Instance Method Detail

def !=(other : PyObject) : PyObject #

[View source]
def !=(other) : PyObject #
Description copied from class Object

Returns true if this object is not equal to other.

By default this method is implemented as !(self == other) so there's no need to override this unless there's a more efficient way to do it.


[View source]
def %(other : PyObject) : PyObject #

[View source]
def %(other) : PyObject #

[View source]
def *(other : PyObject) : PyObject #

[View source]
def *(other) : PyObject #

[View source]
def **(other : PyObject) : PyObject #

[View source]
def **(other) : PyObject #

[View source]
def +(other : PyObject) : PyObject #

[View source]
def +(other) : PyObject #

[View source]
def -(other : PyObject) : PyObject #

[View source]
def -(other) : PyObject #

[View source]
def /(other : PyObject) : PyObject #

[View source]
def /(other) : PyObject #

[View source]
def //(other : PyObject) : PyObject #

[View source]
def //(other) : PyObject #

[View source]
def <(other : PyObject) : PyObject #

[View source]
def <(other) : PyObject #

[View source]
def <=(other : PyObject) : PyObject #

[View source]
def <=(other) : PyObject #

[View source]
def ==(other : PyObject) : PyObject #

[View source]
def ==(other) : PyObject #
Description copied from class Reference

Returns false (other can only be a Value here).


[View source]
def >(other : PyObject) : PyObject #

[View source]
def >(other) : PyObject #

[View source]
def >=(other : PyObject) : PyObject #

[View source]
def >=(other) : PyObject #

[View source]
def [](*key) : PyObject #

[View source]
def []=(key, value) : Nil #

[View source]
def call(call : String | Symbol, *args, **kwargs) : PyObject #

[View source]
def finalize #

[View source]
def get_type_name : String #

Helper method to get Python object type name


[View source]
def inspect(io) : Nil #

[View source]
def need_decref : Bool #

[View source]
def need_decref=(need_decref : Bool) #

[View source]
def raw : Pointer(Void) #

Access the raw Python object pointer


[View source]
def to_a(element_type : T.class) : Array(T) forall T #

Convert to Crystal Array


[View source]
def to_b : Bool #

Convert to Crystal Bool


[View source]
def to_complex : Complex #

Convert Python complex to Crystal Complex


[View source]
def to_cr #

Convert to appropriate Crystal type


[View source]
def to_dict : Hash(PyObject, PyObject) #

Convert Python dict to Crystal Hash(PyObject, PyObject)


[View source]
def to_f64 : Float64 #

Convert to Crystal Float64


[View source]
def to_h(key_type : K.class, value_type : V.class) : Hash(K, V) forall K, V #

Convert to Crystal Hash


[View source]
def to_i32 : Int32 #

Convert to Crystal Int32


[View source]
def to_i64 : Int64 #

Convert to Crystal Int64


[View source]
def to_list : Array(PyObject) #

Convert Python list to Crystal Array(PyObject)


[View source]
def to_py : PyObject #

[View source]
def to_s(io : IO) : Nil #

Convert to Crystal String


[View source]
def to_s(io) : Nil #

[View source]
def to_tuple : Array(PyObject) #

Convert Python tuple to Crystal Array(PyObject)


[View source]