Sha256: 9edd8e8334a6ed2e28bdf01922424a60c6c191028b8535de91a06a469d1f2546

Contents?: true

Size: 602 Bytes

Versions: 14

Compression:

Stored size: 602 Bytes

Contents

module RubyPython
  # Creates a Ruby class that inherits from a proxied Python object.
  def self.Type(name)
    mod, match, klass = name.rpartition(".")
    pymod = RubyPython.import(mod)
    pyclass = pymod.pObject.getAttr(klass)
    rclass = Class.new(RubyPyProxy) do
      define_method(:initialize) do |*args|
        args = PyObject.convert(*args)
        pTuple = PyObject.buildArgTuple(*args)
        pReturn = pyclass.callObject(pTuple)
        if PythonError.error?
          raise PythonError.handle_error
        end
        @pObject = pReturn
      end
    end
    return rclass
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
lokeshh_rubypython-0.7.1 lib/rubypython/type.rb
lokeshh_rubypython-0.7 lib/rubypython/type.rb
rubypython-0.6.4 lib/rubypython/type.rb
rubypython-0.6.3 lib/rubypython/type.rb
rubypython-raspi-0.1.2 lib/rubypython/type.rb
rubypython-raspi-0.1.1 lib/rubypython/type.rb
rubypython-raspi-0.1.0 lib/rubypython/type.rb
rubypython-0.6.2 lib/rubypython/type.rb
rubypython-0.6.1 lib/rubypython/type.rb
rubypython-0.6.0 lib/rubypython/type.rb
rubypython-0.5.3 lib/rubypython/type.rb
rubypython-0.5.2 lib/rubypython/type.rb
rubypython-0.5.1 lib/rubypython/type.rb
rubypython-0.5.0 lib/rubypython/type.rb