Class: RubyPython::RubyPyClass

Inherits:
RubyPyProxy show all
Defined in:
lib/rubypython/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, #respond_to?, #rubify, #to_a, #to_s

Methods included from Operators

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

Methods inherited from BlankObject

hide

Constructor Details

This class inherits a constructor from RubyPython::RubyPyProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RubyPython::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.



246
247
248
249
250
251
252
253
254
# File 'lib/rubypython/rubypyproxy.rb', line 246

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