private static RubyString str(final ThreadContext context, final IRubyObject self) { final IRubyObject str = (IRubyObject) self.getInternalVariables().getInternalVariable("str"); return /* str == null ? string(context, self) : */ str.convertToString(); }
private static RubyString str(final ThreadContext context, final IRubyObject self) { final IRubyObject str = (IRubyObject) self.getInternalVariables().getInternalVariable("str"); return /* str == null ? string(context, self) : */ str.convertToString(); }
@JRubyMethod(visibility = PRIVATE) public static IRubyObject private_iv_get(ThreadContext context, IRubyObject self, IRubyObject target, IRubyObject prop) { IRubyObject obj = (IRubyObject)target.getInternalVariables().getInternalVariable(prop.asJavaString()); if (obj == null) obj = context.nil; return obj; } }
@JRubyMethod(visibility = PRIVATE) public static IRubyObject private_iv_get(ThreadContext context, IRubyObject self, IRubyObject target, IRubyObject prop) { IRubyObject obj = (IRubyObject)target.getInternalVariables().getInternalVariable(prop.asJavaString()); if (obj == null) obj = context.nil; return obj; } }
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) { InternalVariables variables = enumerator.getInternalVariables(); final IRubyObject enumerable = (IRubyObject) variables.getInternalVariable("chunk_enumerable"); final RubyProc categorize = (RubyProc) variables.getInternalVariable("chunk_categorize"); final IRubyObject yielder = packEnumValues(context, args); final ChunkArg arg = new ChunkArg(context);
@JRubyMethod(meta = true) public static IRubyObject list(ThreadContext context, IRubyObject recv) { Ruby runtime = recv.getRuntime(); RubyHash names; synchronized (recv) { names = (RubyHash) recv.getInternalVariables().getInternalVariable("signal_list"); if (names == null) { names = RubyHash.newHash(runtime); for (Map.Entry<String, Integer> sig : RubySignal.list().entrySet()) { names.op_aset(context, runtime.freezeAndDedupString(runtime.newString(sig.getKey())), runtime.newFixnum(sig.getValue())); } names.op_aset(context, runtime.freezeAndDedupString(runtime.newString("EXIT")), runtime.newFixnum(0)); recv.getInternalVariables().setInternalVariable("signal_list", names); } else { names.dup(context); } } return names; }
public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) { InternalVariables variables = enumerator.getInternalVariables(); final IRubyObject enumerable = (IRubyObject) variables.getInternalVariable("chunk_enumerable"); final RubyProc categorize = (RubyProc) variables.getInternalVariable("chunk_categorize"); final IRubyObject yielder = packEnumValues(context, args); final ChunkArg arg = new ChunkArg(context);
@JRubyMethod(visibility = Visibility.PRIVATE) public static IRubyObject initialize(ThreadContext context, IRubyObject self, IRubyObject javaClassName, Block block) { Ruby runtime = context.runtime; self.getInstanceVariables().setInstanceVariable("@java_class", JavaClass.forNameVerbose(runtime, javaClassName.asJavaString())); self.getInstanceVariables().setInstanceVariable("@block", RubyProc.newProc(runtime, block, block.type)); self.getInternalVariables().getInternalVariable("@block"); return context.nil; }
@JRubyMethod(meta = true) public static IRubyObject list(ThreadContext context, IRubyObject recv) { Ruby runtime = recv.getRuntime(); RubyHash names; synchronized (recv) { names = (RubyHash) recv.getInternalVariables().getInternalVariable("signal_list"); if (names == null) { names = RubyHash.newHash(runtime); for (Map.Entry<String, Integer> sig : RubySignal.list().entrySet()) { names.op_aset(context, runtime.freezeAndDedupString(runtime.newString(sig.getKey())), runtime.newFixnum(sig.getValue())); } names.op_aset(context, runtime.freezeAndDedupString(runtime.newString("EXIT")), runtime.newFixnum(0)); recv.getInternalVariables().setInternalVariable("signal_list", names); } else { names.dup(context); } } return names; }
@JRubyMethod(visibility = Visibility.PRIVATE) public static IRubyObject initialize(ThreadContext context, IRubyObject self, IRubyObject javaClassName, Block block) { Ruby runtime = context.runtime; self.getInstanceVariables().setInstanceVariable("@java_class", JavaClass.forNameVerbose(runtime, javaClassName.asJavaString())); self.getInstanceVariables().setInstanceVariable("@block", RubyProc.newProc(runtime, block, block.type)); self.getInternalVariables().getInternalVariable("@block"); return context.nil; }
IRubyObject nano_num = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_num"); IRubyObject nano_den = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_den"); IRubyObject offset = (IRubyObject) from.getInternalVariables().getInternalVariable("offset");
IRubyObject nano_num = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_num"); IRubyObject nano_den = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_den"); IRubyObject offset = (IRubyObject) from.getInternalVariables().getInternalVariable("offset");
IRubyObject nano_num = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_num"); IRubyObject nano_den = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_den"); IRubyObject offsetVar = (IRubyObject) from.getInternalVariables().getInternalVariable("offset"); IRubyObject zoneVar = (IRubyObject) from.getInternalVariables().getInternalVariable("zone");
IRubyObject nano_num = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_num"); IRubyObject nano_den = (IRubyObject) from.getInternalVariables().getInternalVariable("nano_den"); IRubyObject offsetVar = (IRubyObject) from.getInternalVariables().getInternalVariable("offset"); IRubyObject zoneVar = (IRubyObject) from.getInternalVariables().getInternalVariable("zone");
@JRubyMethod(module = true) public static IRubyObject timeout(final ThreadContext context, IRubyObject recv, IRubyObject seconds, IRubyObject exceptionType, IRubyObject message, Block block) { IRubyObject timeout = context.runtime.getModule("Timeout"); // No seconds, just yield if ( nilOrZeroSeconds(context, seconds) ) { return block.yieldSpecific(context); } final Ruby runtime = context.runtime; final RubyThread currentThread = context.getThread(); final AtomicBoolean latch = new AtomicBoolean(false); IRubyObject id = new RubyObject(runtime, runtime.getObject()); Runnable timeoutRunnable = exceptionType.isNil() ? TimeoutTask.newAnonymousTask(currentThread, timeout, latch, id, message.convertToString()) : TimeoutTask.newTaskWithException(currentThread, timeout, latch, exceptionType, message.convertToString()); ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) timeout.getInternalVariables().getInternalVariable("__executor__"); try { return yieldWithTimeout(executor, context, seconds, block, timeoutRunnable, latch); } catch (RaiseException re) { // if it's the exception we're expecting if (re.getException().getMetaClass() == getDefaultException(timeout)) { // and we were not given a specific exception if ( exceptionType.isNil() ) { raiseTimeoutErrorIfMatches(context, timeout, re, id); } } // otherwise, rethrow throw re; } }
@JRubyMethod(module = true) public static IRubyObject timeout(final ThreadContext context, IRubyObject recv, IRubyObject seconds, IRubyObject exceptionType, IRubyObject message, Block block) { IRubyObject timeout = context.runtime.getModule("Timeout"); // No seconds, just yield if ( nilOrZeroSeconds(context, seconds) ) { return block.yieldSpecific(context); } final Ruby runtime = context.runtime; final RubyThread currentThread = context.getThread(); final AtomicBoolean latch = new AtomicBoolean(false); IRubyObject id = new RubyObject(runtime, runtime.getObject()); Runnable timeoutRunnable = exceptionType.isNil() ? TimeoutTask.newAnonymousTask(currentThread, timeout, latch, id, message.convertToString()) : TimeoutTask.newTaskWithException(currentThread, timeout, latch, exceptionType, message.convertToString()); ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) timeout.getInternalVariables().getInternalVariable("__executor__"); try { return yieldWithTimeout(executor, context, seconds, block, timeoutRunnable, latch); } catch (RaiseException re) { // if it's the exception we're expecting if (re.getException().getMetaClass() == getDefaultException(timeout)) { // and we were not given a specific exception if ( exceptionType.isNil() ) { raiseTimeoutErrorIfMatches(context, timeout, re, id); } } // otherwise, rethrow throw re; } }
Boolean blocking = (Boolean)recv.getInternalVariables().getInternalVariable("group_blocking"); if (blocking != null && blocking) { throw runtime.newRuntimeError("parallel group iteration");
Boolean blocking = (Boolean)recv.getInternalVariables().getInternalVariable("group_blocking"); if (blocking != null && blocking) { throw runtime.newRuntimeError("parallel group iteration");
Boolean blocking = (Boolean)recv.getInternalVariables().getInternalVariable("group_blocking"); if (blocking != null && blocking) { throw runtime.newRuntimeError("parallel group iteration");
Boolean blocking = (Boolean)recv.getInternalVariables().getInternalVariable("group_blocking"); if (blocking != null && blocking) { throw runtime.newRuntimeError("parallel group iteration");