本文整理了Java中org.jruby.Ruby.getCurrentContext
方法的一些代码示例,展示了Ruby.getCurrentContext
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getCurrentContext
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getCurrentContext
暂无
代码示例来源:origin: asciidoctor/asciidoctorj
@Override
public void register(IRubyObject registry) {
registry.callMethod(rubyRuntime.getCurrentContext(), "postprocessor", rubyClass);
}
});
代码示例来源:origin: org.jruby/jruby-complete
@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
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static long callRubyMethod(IRubyObject recv, Object methodName, IRubyObject[] args) {
IRubyObject retval = recv.callMethod(recv.getRuntime().getCurrentContext(),
methodName.toString(), args);
return Handle.nativeHandle(retval);
}
代码示例来源:origin: org.jruby/jruby-core
@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;
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static long callRubyMethod(IRubyObject recv, Object methodName, IRubyObject[] args) {
IRubyObject retval = recv.callMethod(recv.getRuntime().getCurrentContext(),
methodName.toString(), args);
return Handle.nativeHandle(retval);
}
代码示例来源:origin: asciidoctor/asciidoctorj
@Override
public void register(IRubyObject registry) {
registry.callMethod(rubyRuntime.getCurrentContext(), "postprocessor", rubyClass);
}
});
代码示例来源:origin: org.jruby/jruby-complete
@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;
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: org.jruby/jruby-complete
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;
}
代码示例来源:origin: org.jruby/yecht
@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;
}
代码示例来源:origin: asciidoctor/asciidoctorj
@Override
public void register(IRubyObject registry) {
registry.callMethod(rubyRuntime.getCurrentContext(), "include_processor", rubyClass);
}
});
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@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;
}
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated
public static IRubyObject open(IRubyObject recv, IRubyObject[] args, Block block) {
return open(recv.getRuntime().getCurrentContext(), recv, args, block);
}
}// RubyUDPSocket
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
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;
}
代码示例来源:origin: org.jruby/jruby-complete
@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();
}
代码示例来源:origin: org.jruby/jruby-complete
@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);
}
代码示例来源:origin: asciidoctor/asciidoctorj
@Override
public void register(IRubyObject registry) {
registry.callMethod(rubyRuntime.getCurrentContext(), "tree_processor", rubyClass);
}
});
内容来源于网络,如有侵权,请联系作者删除!