本文整理了Java中org.jruby.runtime.Block.getBody()
方法的一些代码示例,展示了Block.getBody()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.getBody()
方法的具体详情如下:
包路径:org.jruby.runtime.Block
类名称:Block
方法名:getBody
暂无
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "to_s", compat = RUBY1_9)
public IRubyObject to_s19() {
StringBuilder sb = new StringBuilder("#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
block.getBody().getFile() + ":" + (block.getBody().getLine() + 1));
if (isLambda()) sb.append(" (lambda)");
sb.append(">");
return RubyString.newString(getRuntime(), sb.toString());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "to_s", compat = RUBY1_9)
public IRubyObject to_s19() {
StringBuilder sb = new StringBuilder("#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
block.getBody().getFile() + ":" + (block.getBody().getLine() + 1));
if (isLambda()) sb.append(" (lambda)");
sb.append(">");
return RubyString.newString(getRuntime(), sb.toString());
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject[] prepareProcArgs(ThreadContext context, Block b, IRubyObject[] args) {
if (args.length != 1) return args;
// Potentially expand single value if it is an array depending on what we are calling.
return IRRuntimeHelpers.convertValueIntoArgArray(context, args[0], b.getBody().getSignature(), b.type == Block.Type.NORMAL && args[0] instanceof RubyArray);
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject[] prepareProcArgs(ThreadContext context, Block b, IRubyObject[] args) {
if (args.length != 1) return args;
// Potentially expand single value if it is an array depending on what we are calling.
return IRRuntimeHelpers.convertValueIntoArgArray(context, args[0], b.getBody().getSignature(), b.type == Block.Type.NORMAL && args[0] instanceof RubyArray);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "to_s", compat = RUBY1_8)
@Override
public IRubyObject to_s() {
return RubyString.newString(
getRuntime(),"#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
block.getBody().getFile() + ":" + (block.getBody().getLine() + 1) + ">");
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "to_s", compat = RUBY1_8)
@Override
public IRubyObject to_s() {
return RubyString.newString(
getRuntime(),"#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
block.getBody().getFile() + ":" + (block.getBody().getLine() + 1) + ">");
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public Signature getSignature() {
return proc.getBlock().getBody().getSignature();
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public ArgumentDescriptor[] getArgumentDescriptors() {
return proc.getBlock().getBody().getArgumentDescriptors();
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public Signature getSignature() {
return proc.getBlock().getBody().getSignature();
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public ArgumentDescriptor[] getArgumentDescriptors() {
return proc.getBlock().getBody().getArgumentDescriptors();
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = {"call", "[]", "yield", "==="}, rest = true, omit = true)
public final IRubyObject call(ThreadContext context, IRubyObject[] args, Block blockCallArg) {
IRubyObject[] preppedArgs = prepareArgs(context, type, block.getBody(), args);
return call(context, preppedArgs, null, blockCallArg);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(name = {"call", "[]", "yield", "==="}, rest = true, omit = true)
public final IRubyObject call(ThreadContext context, IRubyObject[] args, Block blockCallArg) {
IRubyObject[] preppedArgs = prepareArgs(context, type, block.getBody(), args);
return call(context, preppedArgs, null, blockCallArg);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject parameters(ThreadContext context) {
BlockBody body = this.getBlock().getBody();
return Helpers.argumentDescriptorsToParameters(context.runtime,
body.getArgumentDescriptors(), isLambda());
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject parameters(ThreadContext context) {
BlockBody body = this.getBlock().getBody();
return Helpers.argumentDescriptorsToParameters(context.runtime,
body.getArgumentDescriptors(), isLambda());
}
代码示例来源:origin: org.jruby/jruby-complete
@Interp @JIT
public static IRubyObject[] prepareBlockArgs(ThreadContext context, Block block, IRubyObject[] args, boolean usesKwArgs) {
args = prepareBlockArgsInternal(context, block, args);
if (usesKwArgs) {
args = frobnicateKwargsArgument(context, args, block.getBody().getSignature().required());
}
return args;
}
代码示例来源:origin: org.jruby/jruby-core
@Interp @JIT
public static IRubyObject[] prepareBlockArgs(ThreadContext context, Block block, IRubyObject[] args, boolean usesKwArgs) {
args = prepareBlockArgsInternal(context, block, args);
if (usesKwArgs) {
args = frobnicateKwargsArgument(context, args, block.getBody().getSignature().required());
}
return args;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "parameters", compat = RUBY1_9)
public IRubyObject parameters(ThreadContext context) {
BlockBody body = this.getBlock().getBody();
if (body instanceof MethodBlock) return ((MethodBlock) body).getMethod().parameters(context);
return Helpers.parameterListToParameters(context.runtime,
body.getParameterList(), isLambda());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "parameters", compat = RUBY1_9)
public IRubyObject parameters(ThreadContext context) {
BlockBody body = this.getBlock().getBody();
if (body instanceof MethodBlock) return ((MethodBlock) body).getMethod().parameters(context);
return Helpers.parameterListToParameters(context.runtime,
body.getParameterList(), isLambda());
}
代码示例来源:origin: org.jruby/jruby-complete
private DynamicMethod createProcMethod(Ruby runtime, String name, Visibility visibility, Block block) {
block = block.cloneBlockAndFrame();
block.getBinding().getFrame().setKlazz(this);
block.getBinding().getFrame().setName(name);
block.getBinding().setMethod(name);
// a normal block passed to define_method changes to do arity checking; make it a lambda
RubyProc proc = runtime.newProc(Block.Type.LAMBDA, block);
// various instructions can tell this scope is not an ordinary block but a block representing
// a method definition.
block.getBody().getStaticScope().makeArgumentScope();
return new ProcMethod(this, proc, visibility, name);
}
代码示例来源:origin: org.jruby/jruby-core
private DynamicMethod createProcMethod(Ruby runtime, String name, Visibility visibility, Block block) {
block = block.cloneBlockAndFrame();
block.getBinding().getFrame().setKlazz(this);
block.getBinding().getFrame().setName(name);
block.getBinding().setMethod(name);
// a normal block passed to define_method changes to do arity checking; make it a lambda
RubyProc proc = runtime.newProc(Block.Type.LAMBDA, block);
// various instructions can tell this scope is not an ordinary block but a block representing
// a method definition.
block.getBody().getStaticScope().makeArgumentScope();
return new ProcMethod(this, proc, visibility, name);
}
内容来源于网络,如有侵权,请联系作者删除!