Class: Rupy::RubyPyClass

Inherits:
RubyPyProxy show all
Defined in:
lib/rupy/rubypyproxy.rb

Overview

A class to wrap Python Classes.

Instance Attribute Summary

Attributes inherited from RubyPyProxy

#pObject

Instance Method Summary collapse

Methods inherited from RubyPyProxy

#_wrap, #initialize, #inspect, #is_real_method?, #method_missing, #methods, #respond_to?, #rubify, #to_a, #to_enum, #to_s

Methods included from Operators

#<=>, #[], #[]=, bin_op, #include?, operator_, rel_op, unary_op

Methods inherited from BlankObject

hide

Constructor Details

This class inherits a constructor from Rupy::RubyPyProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Rupy::RubyPyProxy

Instance Method Details

#new(*args) ⇒ Object

Create an instance of the wrapped class. This is a workaround for the fact that Python classes are meant to be callable.



208
209
210
211
212
213
214
215
216
# File 'lib/rupy/rubypyproxy.rb', line 208

def new(*args)
    args = PyObject.convert(*args)
    pTuple = PyObject.buildArgTuple(*args)
    pReturn = @pObject.callObject(pTuple)
    if PythonError.error?
        raise PythonError.handle_error
    end
    RubyPyInstance.new pReturn
end