本文整理了Java中org.jruby.Ruby.getGenerator
方法的一些代码示例,展示了Ruby.getGenerator
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getGenerator
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getGenerator
暂无
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize_copy(ThreadContext context, IRubyObject other) {
if (!(other instanceof RubyGenerator)) {
throw context.runtime.newTypeError(other, context.runtime.getGenerator());
}
checkFrozen();
this.proc = ((RubyGenerator)other).proc;
return this;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize_copy(ThreadContext context, IRubyObject other) {
if (!(other instanceof RubyGenerator)) {
throw context.runtime.newTypeError(other, context.runtime.getGenerator());
}
checkFrozen();
this.proc = ((RubyGenerator)other).proc;
return this;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "initialize", visibility = PRIVATE, rest = true)
public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block) {
Ruby runtime = context.runtime;
IRubyObject object;
IRubyObject method = runtime.newSymbol("each");
IRubyObject size = null;
if (block.isGiven()) {
Arity.checkArgumentCount(runtime, args, 0, 1);
if (args.length > 0) {
size = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
if ( ! (size.isNil() || size.respondsTo("call")) &&
! (runtime.getFloat().isInstance(size) && ((RubyFloat) size).getDoubleValue() == Float.POSITIVE_INFINITY) &&
! (size instanceof RubyInteger) ) {
throw runtime.newTypeError(size, runtime.getInteger());
}
}
object = runtime.getGenerator().newInstance(context, IRubyObject.NULL_ARRAY, block);
} else {
Arity.checkArgumentCount(runtime, args, 1, -1);
// TODO need a deprecation WARN here, but can't add it until ruby/jruby/kernel20/enumerable.rb is deleted or stops calling this without a block
object = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
if (args.length > 0) {
method = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
}
}
return initialize(runtime, object, method, args, size, null);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = "initialize", visibility = PRIVATE, rest = true)
public IRubyObject initialize(ThreadContext context, IRubyObject[] args, Block block) {
Ruby runtime = context.runtime;
IRubyObject object;
IRubyObject method = runtime.newSymbol("each");
IRubyObject size = null;
if (block.isGiven()) {
Arity.checkArgumentCount(runtime, args, 0, 1);
if (args.length > 0) {
size = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
if ( ! (size.isNil() || size.respondsTo("call")) &&
! (runtime.getFloat().isInstance(size) && ((RubyFloat) size).getDoubleValue() == Float.POSITIVE_INFINITY) &&
! (size instanceof RubyInteger) ) {
throw runtime.newTypeError(size, runtime.getInteger());
}
}
object = runtime.getGenerator().newInstance(context, IRubyObject.NULL_ARRAY, block);
} else {
Arity.checkArgumentCount(runtime, args, 1, -1);
// TODO need a deprecation WARN here, but can't add it until ruby/jruby/kernel20/enumerable.rb is deleted or stops calling this without a block
object = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
if (args.length > 0) {
method = args[0];
args = Arrays.copyOfRange(args, 1, args.length);
}
}
return initialize(runtime, object, method, args, size, null);
}
内容来源于网络,如有侵权,请联系作者删除!