public boolean is1_8() { return !(is1_9() || is2_0()); }
public boolean is1_8() { return !(is1_9() || is2_0()); }
public Encoding getDefaultEncoding() { if (defaultEncoding == null) { if (runtime.is2_0()) { defaultEncoding = UTF8Encoding.INSTANCE; } else { defaultEncoding = getEncodingService().loadEncoding(USASCII); } } return defaultEncoding; }
public Encoding getDefaultEncoding() { if (defaultEncoding == null) { if (runtime.is2_0()) { defaultEncoding = UTF8Encoding.INSTANCE; } else { defaultEncoding = getEncodingService().loadEncoding(USASCII); } } return defaultEncoding; }
private static void blockPreTrace(Ruby runtime, ThreadContext context, String name, RubyModule implClass) { if (runtime.hasEventHooks() && runtime.is2_0()) context.trace(RubyEvent.B_CALL, name, implClass); }
private static void blockPostTrace(Ruby runtime, ThreadContext context, String name, RubyModule implClass) { if (runtime.hasEventHooks() && runtime.is2_0()) context.trace(RubyEvent.B_RETURN, name, implClass); }
private static void blockPreTrace(Ruby runtime, ThreadContext context, String name, RubyModule implClass) { if (runtime.hasEventHooks() && runtime.is2_0()) context.trace(RubyEvent.B_CALL, name, implClass); }
private static void blockPostTrace(Ruby runtime, ThreadContext context, String name, RubyModule implClass) { if (runtime.hasEventHooks() && runtime.is2_0()) context.trace(RubyEvent.B_RETURN, name, implClass); }
private boolean is1_8() { return !(getRuntime().is1_9() || getRuntime().is2_0()); }
private boolean is1_8() { return !(getRuntime().is1_9() || getRuntime().is2_0()); }
public static IRBuilder createIRBuilder(Ruby runtime, IRManager manager) { boolean is19 = runtime.is1_9(); boolean is20 = runtime.is2_0(); if (is20) { return new IRBuilder20(manager); } else if (is19) { return new IRBuilder19(manager); } else { return new IRBuilder(manager); } }
/** Create the ObjectSpace module and add it to the Ruby runtime. * */ public static RubyModule createObjectSpaceModule(Ruby runtime) { RubyModule objectSpaceModule = runtime.defineModule("ObjectSpace"); runtime.setObjectSpaceModule(objectSpaceModule); objectSpaceModule.defineAnnotatedMethods(RubyObjectSpace.class); if (runtime.is2_0()) { WeakMap.createWeakMap(runtime); } return objectSpaceModule; }
/** Create the ObjectSpace module and add it to the Ruby runtime. * */ public static RubyModule createObjectSpaceModule(Ruby runtime) { RubyModule objectSpaceModule = runtime.defineModule("ObjectSpace"); runtime.setObjectSpaceModule(objectSpaceModule); objectSpaceModule.defineAnnotatedMethods(RubyObjectSpace.class); if (runtime.is2_0()) { WeakMap.createWeakMap(runtime); } return objectSpaceModule; }
public static IRBuilder createIRBuilder(Ruby runtime, IRManager manager) { boolean is19 = runtime.is1_9(); boolean is20 = runtime.is2_0(); if (is20) { return new IRBuilder20(manager); } else if (is19) { return new IRBuilder19(manager); } else { return new IRBuilder(manager); } }
public RaiseException newLoadError(String message, String path) { RaiseException loadError = newRaiseException(getLoadError(), message); if (is2_0()) loadError.getException().setInstanceVariable("@path", newString(path)); return loadError; }
public RaiseException newLoadError(String message, String path) { RaiseException loadError = newRaiseException(getLoadError(), message); if (is2_0()) loadError.getException().setInstanceVariable("@path", newString(path)); return loadError; }
@JRubyMethod(name = "==", compat = CompatVersion.RUBY1_9) @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if (this == other) return context.runtime.getTrue(); boolean equal = context.runtime.getException().isInstance(other) && callMethod(context, "message").equals(other.callMethod(context, "message")) && callMethod(context, "backtrace").equals(other.callMethod(context, "backtrace")); if (context.runtime.is2_0()) { equal = equal && getMetaClass().getRealClass() == other.getMetaClass().getRealClass(); } return context.runtime.newBoolean(equal); }
@JRubyMethod(name = "==", compat = CompatVersion.RUBY1_9) @Override public IRubyObject op_equal(ThreadContext context, IRubyObject other) { if (this == other) return context.runtime.getTrue(); boolean equal = context.runtime.getException().isInstance(other) && callMethod(context, "message").equals(other.callMethod(context, "message")) && callMethod(context, "backtrace").equals(other.callMethod(context, "backtrace")); if (context.runtime.is2_0()) { equal = equal && getMetaClass().getRealClass() == other.getMetaClass().getRealClass(); } return context.runtime.newBoolean(equal); }
public static void defineEnumerator(Ruby runtime) { RubyModule enm = runtime.getClassFromPath("Enumerable"); final RubyClass enmr; if (runtime.is1_9() || runtime.is2_0()) { enmr = runtime.defineClass("Enumerator", runtime.getObject(), ENUMERATOR_ALLOCATOR); } else { enmr = enm.defineClassUnder("Enumerator", runtime.getObject(), ENUMERATOR_ALLOCATOR); } enmr.includeModule(enm); enmr.defineAnnotatedMethods(RubyEnumerator.class); runtime.setEnumerator(enmr); RubyYielder.createYielderClass(runtime); }
public static void defineEnumerator(Ruby runtime) { RubyModule enm = runtime.getClassFromPath("Enumerable"); final RubyClass enmr; if (runtime.is1_9() || runtime.is2_0()) { enmr = runtime.defineClass("Enumerator", runtime.getObject(), ENUMERATOR_ALLOCATOR); } else { enmr = enm.defineClassUnder("Enumerator", runtime.getObject(), ENUMERATOR_ALLOCATOR); } enmr.includeModule(enm); enmr.defineAnnotatedMethods(RubyEnumerator.class); runtime.setEnumerator(enmr); RubyYielder.createYielderClass(runtime); }