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

#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, 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.



307
308
309
310
311
312
313
# File 'lib/rubypython/rubypyproxy.rb', line 307

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