/** * Will create the Ruby class Object in the runtime * specified. This method needs to take the actual class as an * argument because of the Object class' central part in runtime * initialization. */ public static RubyClass createObjectClass(Ruby runtime, RubyClass objectClass) { objectClass.setClassIndex(ClassIndex.OBJECT); objectClass.setReifiedClass(RubyObject.class); return objectClass; }
public static RubyClass createModuleClass(Ruby runtime, RubyClass moduleClass) { moduleClass.setClassIndex(ClassIndex.MODULE); moduleClass.setReifiedClass(RubyModule.class); moduleClass.kindOf = new RubyModule.JavaClassKindOf(RubyModule.class); moduleClass.defineAnnotatedMethods(RubyModule.class); moduleClass.defineAnnotatedMethods(ModuleKernelMethods.class); return moduleClass; }
/** * Will create the Ruby class Object in the runtime * specified. This method needs to take the actual class as an * argument because of the Object class' central part in runtime * initialization. */ public static RubyClass createBasicObjectClass(Ruby runtime, RubyClass objectClass) { objectClass.setClassIndex(ClassIndex.OBJECT); objectClass.defineAnnotatedMethods(RubyBasicObject.class); recacheBuiltinMethods(runtime); return objectClass; }
public static RubyClass createModuleClass(Ruby runtime, RubyClass moduleClass) { moduleClass.setClassIndex(ClassIndex.MODULE); moduleClass.setReifiedClass(RubyModule.class); moduleClass.kindOf = new RubyModule.JavaClassKindOf(RubyModule.class); moduleClass.defineAnnotatedMethods(RubyModule.class); moduleClass.defineAnnotatedMethods(ModuleKernelMethods.class); return moduleClass; }
/** * Will create the Ruby class Object in the runtime * specified. This method needs to take the actual class as an * argument because of the Object class' central part in runtime * initialization. */ public static RubyClass createBasicObjectClass(Ruby runtime, RubyClass objectClass) { objectClass.setClassIndex(ClassIndex.OBJECT); objectClass.defineAnnotatedMethods(RubyBasicObject.class); recacheBuiltinMethods(runtime); return objectClass; }
/** * Will create the Ruby class Object in the runtime * specified. This method needs to take the actual class as an * argument because of the Object class' central part in runtime * initialization. */ public static RubyClass createObjectClass(Ruby runtime, RubyClass objectClass) { objectClass.setClassIndex(ClassIndex.OBJECT); objectClass.setReifiedClass(RubyObject.class); return objectClass; }
/** Create the RubyMethod class and add it to the Ruby runtime. * */ public static RubyClass createMethodClass(Ruby runtime) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here. Confirm. JRUBY-415 RubyClass methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setMethod(methodClass); methodClass.setClassIndex(ClassIndex.METHOD); methodClass.setReifiedClass(RubyMethod.class); methodClass.defineAnnotatedMethods(AbstractRubyMethod.class); methodClass.defineAnnotatedMethods(RubyMethod.class); return methodClass; }
public static RubyClass createYielderClass(Ruby runtime) { RubyClass yielderc = runtime.defineClassUnder("Yielder", runtime.getObject(), YIELDER_ALLOCATOR, runtime.getEnumerator()); runtime.setYielder(yielderc); yielderc.setClassIndex(ClassIndex.YIELDER); yielderc.kindOf = new RubyModule.JavaClassKindOf(RubyYielder.class); yielderc.defineAnnotatedMethods(RubyYielder.class); return yielderc; }
public static RubyClass createProcClass(Ruby runtime) { RubyClass procClass = runtime.defineClass("Proc", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setProc(procClass); procClass.setClassIndex(ClassIndex.PROC); procClass.setReifiedClass(RubyProc.class); procClass.defineAnnotatedMethods(RubyProc.class); return procClass; }
public static RubyClass createYielderClass(Ruby runtime) { RubyClass yielderc = runtime.defineClassUnder("Yielder", runtime.getObject(), YIELDER_ALLOCATOR, runtime.getEnumerator()); runtime.setYielder(yielderc); yielderc.setClassIndex(ClassIndex.YIELDER); yielderc.kindOf = new RubyModule.JavaClassKindOf(RubyYielder.class); yielderc.defineAnnotatedMethods(RubyYielder.class); return yielderc; }
/** Create the RubyMethod class and add it to the Ruby runtime. * */ public static RubyClass createMethodClass(Ruby runtime) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here. Confirm. JRUBY-415 RubyClass methodClass = runtime.defineClass("Method", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setMethod(methodClass); methodClass.setClassIndex(ClassIndex.METHOD); methodClass.setReifiedClass(RubyMethod.class); methodClass.defineAnnotatedMethods(AbstractRubyMethod.class); methodClass.defineAnnotatedMethods(RubyMethod.class); return methodClass; }
public static RubyClass createThreadGroupClass(Ruby runtime) { RubyClass threadGroupClass = runtime.defineClass("ThreadGroup", runtime.getObject(), THREADGROUP_ALLOCATOR); runtime.setThreadGroup(threadGroupClass); threadGroupClass.setClassIndex(ClassIndex.THREADGROUP); threadGroupClass.defineAnnotatedMethods(RubyThreadGroup.class); // create the default thread group RubyThreadGroup defaultThreadGroup = new RubyThreadGroup(runtime, threadGroupClass); runtime.setDefaultThreadGroup(defaultThreadGroup); threadGroupClass.defineConstant("Default", defaultThreadGroup); return threadGroupClass; }
public static RubyClass createProcClass(Ruby runtime) { RubyClass procClass = runtime.defineClass("Proc", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setProc(procClass); procClass.setClassIndex(ClassIndex.PROC); procClass.setReifiedClass(RubyProc.class); procClass.defineAnnotatedMethods(RubyProc.class); return procClass; }
public static RubyClass createThreadGroupClass(Ruby runtime) { RubyClass threadGroupClass = runtime.defineClass("ThreadGroup", runtime.getObject(), THREADGROUP_ALLOCATOR); runtime.setThreadGroup(threadGroupClass); threadGroupClass.setClassIndex(ClassIndex.THREADGROUP); threadGroupClass.defineAnnotatedMethods(RubyThreadGroup.class); // create the default thread group RubyThreadGroup defaultThreadGroup = new RubyThreadGroup(runtime, threadGroupClass); runtime.setDefaultThreadGroup(defaultThreadGroup); threadGroupClass.defineConstant("Default", defaultThreadGroup); return threadGroupClass; }
public static RubyClass createExceptionClass(Ruby runtime) { RubyClass exceptionClass = runtime.defineClass("Exception", runtime.getObject(), EXCEPTION_ALLOCATOR); runtime.setException(exceptionClass); exceptionClass.setClassIndex(ClassIndex.EXCEPTION); exceptionClass.setReifiedClass(RubyException.class); exceptionClass.setMarshal(EXCEPTION_MARSHAL); exceptionClass.defineAnnotatedMethods(RubyException.class); return exceptionClass; }
public static RubyClass createExceptionClass(Ruby runtime) { RubyClass exceptionClass = runtime.defineClass("Exception", runtime.getObject(), EXCEPTION_ALLOCATOR); runtime.setException(exceptionClass); exceptionClass.setClassIndex(ClassIndex.EXCEPTION); exceptionClass.setReifiedClass(RubyException.class); exceptionClass.setMarshal(EXCEPTION_MARSHAL); exceptionClass.defineAnnotatedMethods(RubyException.class); return exceptionClass; }
public static RubyClass createTrueClass(Ruby runtime) { RubyClass trueClass = runtime.defineClass("TrueClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setTrueClass(trueClass); trueClass.setClassIndex(ClassIndex.TRUE); trueClass.setReifiedClass(RubyBoolean.class); trueClass.defineAnnotatedMethods(True.class); trueClass.defineAnnotatedMethods(RubyBoolean.class); trueClass.getMetaClass().undefineMethod("new"); return trueClass; }
public static RubyClass defineUnboundMethodClass(Ruby runtime) { RubyClass newClass = runtime.defineClass("UnboundMethod", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setUnboundMethod(newClass); newClass.setClassIndex(ClassIndex.UNBOUNDMETHOD); newClass.setReifiedClass(RubyUnboundMethod.class); newClass.defineAnnotatedMethods(AbstractRubyMethod.class); newClass.defineAnnotatedMethods(RubyUnboundMethod.class); newClass.getSingletonClass().undefineMethod("new"); return newClass; }
public static RubyClass defineUnboundMethodClass(Ruby runtime) { RubyClass newClass = runtime.defineClass("UnboundMethod", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setUnboundMethod(newClass); newClass.setClassIndex(ClassIndex.UNBOUNDMETHOD); newClass.setReifiedClass(RubyUnboundMethod.class); newClass.defineAnnotatedMethods(AbstractRubyMethod.class); newClass.defineAnnotatedMethods(RubyUnboundMethod.class); newClass.getSingletonClass().undefineMethod("new"); return newClass; }
public static RubyClass createFalseClass(Ruby runtime) { RubyClass falseClass = runtime.defineClass("FalseClass", runtime.getObject(), ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR); runtime.setFalseClass(falseClass); falseClass.setClassIndex(ClassIndex.FALSE); falseClass.setReifiedClass(RubyBoolean.class); falseClass.defineAnnotatedMethods(False.class); falseClass.defineAnnotatedMethods(RubyBoolean.class); falseClass.getMetaClass().undefineMethod("new"); return falseClass; }