本文整理了Java中org.jruby.Ruby.getProc
方法的一些代码示例,展示了Ruby.getProc
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getProc
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getProc
暂无
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, ISourcePosition sourcePosition) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, sourcePosition);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.jruby/jruby-core
@Deprecated
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, ISourcePosition sourcePosition) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, sourcePosition);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.jruby/jruby-complete
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, String file, int line) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, file, line);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.jruby/jruby-core
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, String file, int line) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, file, line);
proc.setup(block);
return proc;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, ISourcePosition sourcePosition) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, sourcePosition);
proc.setup(block);
return proc;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static RubyProc newProc(Ruby runtime, Block block, Block.Type type, ISourcePosition sourcePosition) {
RubyProc proc = new RubyProc(runtime, runtime.getProc(), type, sourcePosition);
proc.setup(block);
return proc;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY2_0)
public IRubyObject size(ThreadContext context) {
if (size != null) {
if (context.runtime.getProc().isInstance(size)) {
return ((RubyProc)size).call(context, NULL_ARRAY);
}
return size;
}
return context.nil;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY2_0)
public IRubyObject size(ThreadContext context) {
if (size != null) {
if (context.runtime.getProc().isInstance(size)) {
return ((RubyProc)size).call(context, NULL_ARRAY);
}
return size;
}
return context.nil;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "to_proc")
public RubyProc to_proc(ThreadContext context) {
IRubyObject newProc = getOrCreateRubyHashMap().callMethod("to_proc");
TypeConverter.checkType(context, newProc, context.runtime.getProc());
return (RubyProc) newProc;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static IRubyObject coerceProc(IRubyObject proc, Ruby runtime) throws RaiseException {
proc = TypeConverter.convertToType(proc, runtime.getProc(), "to_proc", false);
if (!(proc instanceof RubyProc)) {
throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)");
}
return proc;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "to_proc")
public RubyProc to_proc(ThreadContext context) {
IRubyObject newProc = getOrCreateRubyHashMap().callMethod("to_proc");
TypeConverter.checkType(context, newProc, context.runtime.getProc());
return (RubyProc) newProc;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static IRubyObject coerceProc(IRubyObject proc, Ruby runtime) throws RaiseException {
proc = TypeConverter.convertToType(proc, runtime.getProc(), "to_proc", false);
if (!(proc instanceof RubyProc)) {
throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)");
}
return proc;
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject coerceProc(IRubyObject maybeProc, Ruby runtime) throws RaiseException {
IRubyObject proc = TypeConverter.convertToType(maybeProc, runtime.getProc(), "to_proc", false);
if (!(proc instanceof RubyProc)) {
throw runtime.newTypeError(str(runtime, "wrong argument type ", types(runtime, maybeProc.getMetaClass()), " (expected Proc)"));
}
return proc;
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject coerceProc(IRubyObject maybeProc, Ruby runtime) throws RaiseException {
IRubyObject proc = TypeConverter.convertToType(maybeProc, runtime.getProc(), "to_proc", false);
if (!(proc instanceof RubyProc)) {
throw runtime.newTypeError(str(runtime, "wrong argument type ", types(runtime, maybeProc.getMetaClass()), " (expected Proc)"));
}
return proc;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public static IRubyObject to_proc(final ThreadContext context, final IRubyObject self) {
final Ruby runtime = context.runtime;
final java.lang.Runnable runnable = unwrapIfJavaObject(self);
final Block block = new Block(new RunBody(runtime, runnable));
return new RubyProc(runtime, runtime.getProc(), block, null, -1);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public static IRubyObject to_proc(final ThreadContext context, final IRubyObject self) {
final Ruby runtime = context.runtime;
final java.lang.Runnable runnable = unwrapIfJavaObject(self);
final Block block = new Block(new RunBody(runtime, runnable));
return new RubyProc(runtime, runtime.getProc(), block, null, -1);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "initialize", visibility = PRIVATE, compat = RUBY2_0)
public IRubyObject initialize20(ThreadContext context, IRubyObject object, Block block) {
Ruby runtime = context.runtime;
RubySymbol each = runtime.newSymbol("each");
// check for size
if ((object.isNil() || runtime.getProc().isInstance(object)) ||
runtime.getFloat().isInstance(object) && ((RubyFloat)object).getDoubleValue() == Float.POSITIVE_INFINITY) {
// object is nil, a proc, or infinity; use it for size
IRubyObject gen = context.runtime.getModule("JRuby").getClass("Generator").callMethod(context, "new", new IRubyObject[0], block);
return initialize20(gen, each, NULL_ARRAY, object);
}
return initialize(object, each, NULL_ARRAY);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "initialize", visibility = PRIVATE, compat = RUBY2_0)
public IRubyObject initialize20(ThreadContext context, IRubyObject object, Block block) {
Ruby runtime = context.runtime;
RubySymbol each = runtime.newSymbol("each");
// check for size
if ((object.isNil() || runtime.getProc().isInstance(object)) ||
runtime.getFloat().isInstance(object) && ((RubyFloat)object).getDoubleValue() == Float.POSITIVE_INFINITY) {
// object is nil, a proc, or infinity; use it for size
IRubyObject gen = context.runtime.getModule("JRuby").getClass("Generator").callMethod(context, "new", new IRubyObject[0], block);
return initialize20(gen, each, NULL_ARRAY, object);
}
return initialize(object, each, NULL_ARRAY);
}
内容来源于网络,如有侵权,请联系作者删除!