@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "postprocessor", rubyClass); } });
@Override public boolean contains(RubyHash hash, Object o) { if (!(o instanceof IRubyObject)) return false; IRubyObject obj = (IRubyObject)o; return hash.hasValue(obj.getRuntime().getCurrentContext(), obj); } @Override
public static long callRubyMethod(IRubyObject recv, Object methodName, IRubyObject[] args) { IRubyObject retval = recv.callMethod(recv.getRuntime().getCurrentContext(), methodName.toString(), args); return Handle.nativeHandle(retval); }
@Override public IRubyObject get() { IRubyObject errorInfo = runtime.getGlobalVariables().get("$!"); IRubyObject backtrace = errorInfo.isNil() ? runtime.getNil() : errorInfo.callMethod(errorInfo.getRuntime().getCurrentContext(), "backtrace"); //$@ returns nil if $!.backtrace is not an array if (!(backtrace instanceof RubyArray)) { backtrace = runtime.getNil(); } return backtrace; }
public int read() throws IOException { if (in != null) { return in.read(); } final Ruby runtime = io.getRuntime(); IRubyObject readValue = readAdapter.call(runtime.getCurrentContext(), io, io, numOne); if (readValue.isNil()) return -1; return readValue.convertToString().getByteList().get(0) & 0xff; }
private IRubyObject doCallProcForLink(IRubyObject result, int type) { if (!proc.isNil() && type != ';') { // return the result of the proc, but not for symbols return Helpers.invoke(getRuntime().getCurrentContext(), proc, "call", result); } return result; }
public static long callRubyMethod(IRubyObject recv, Object methodName, IRubyObject[] args) { IRubyObject retval = recv.callMethod(recv.getRuntime().getCurrentContext(), methodName.toString(), args); return Handle.nativeHandle(retval); }
@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "postprocessor", rubyClass); } });
@Override public IRubyObject get() { IRubyObject errorInfo = runtime.getGlobalVariables().get("$!"); IRubyObject backtrace = errorInfo.isNil() ? runtime.getNil() : errorInfo.callMethod(errorInfo.getRuntime().getCurrentContext(), "backtrace"); //$@ returns nil if $!.backtrace is not an array if (!(backtrace instanceof RubyArray)) { backtrace = runtime.getNil(); } return backtrace; }
BlockComparator(ThreadContext context, Block block, IRubyObject self, CallSite gt, CallSite lt) { this.context = context == null ? self.getRuntime().getCurrentContext() : context; this.block = block; this.self = self; this.gt = gt; this.lt = lt; }
public int read() throws IOException { if (in != null) { return in.read(); } IRubyObject readValue = readAdapter.call(io.getRuntime().getCurrentContext(), io, io, numOne); int returnValue = -1; if (!readValue.isNil()) { returnValue = readValue.convertToString().getByteList().get(0) & 0xff; } return returnValue; }
private IRubyObject doCallProcForObj(IRubyObject result) { if (!proc.isNil()) { // return the result of the proc, but not for symbols return Helpers.invoke(getRuntime().getCurrentContext(), proc, "call", result); } return result; }
@JRubyMethod public static IRubyObject initialize(IRubyObject self, IRubyObject type_id, IRubyObject val, IRubyObject style) { Ruby runtime = self.getRuntime(); ThreadContext ctx = runtime.getCurrentContext(); ((RubyObject)self).fastSetInstanceVariable("@kind", ((Node)self).x.scalar); self.callMethod(ctx, "type_id=", type_id); self.callMethod(ctx, "value=", val); self.callMethod(ctx, "style=", style); return self; }
@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "include_processor", rubyClass); } });
@Override public IRubyObject get() { IRubyObject errorInfo = runtime.getGlobalVariables().get("$!"); IRubyObject backtrace = errorInfo.isNil() ? runtime.getNil() : errorInfo.callMethod(errorInfo.getRuntime().getCurrentContext(), "backtrace"); //$@ returns nil if $!.backtrace is not an array if (!(backtrace instanceof RubyArray)) { backtrace = runtime.getNil(); } return backtrace; }
@Deprecated public static IRubyObject open(IRubyObject recv, IRubyObject[] args, Block block) { return open(recv.getRuntime().getCurrentContext(), recv, args, block); } }// RubyUDPSocket
public int read() throws IOException { if (in != null) { return in.read(); } IRubyObject readValue = readAdapter.call(io.getRuntime().getCurrentContext(), io, io, numOne); int returnValue = -1; if (!readValue.isNil()) { returnValue = readValue.convertToString().getByteList().get(0) & 0xff; } return returnValue; }
@Override public int read(byte[] b, int off, int len) throws IOException { RubyString str = RubyString.newStringNoCopy(runtime, b, off, len); IRubyObject i = RubyIO.this.doRead(runtime.getCurrentContext(), len, str); if (i == null || i.isNil()) return -1; return str.size(); }
@Deprecated public static IRubyObject convertToType(IRubyObject obj, RubyClass target, int convertMethodIndex, String convertMethod, boolean raise) { if (!obj.respondsTo(convertMethod)) return handleUncoercibleObject(raise, obj, target); return obj.callMethod(obj.getRuntime().getCurrentContext(), convertMethod); }
@Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "tree_processor", rubyClass); } });