org.jruby.Ruby.newProc()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中org.jruby.Ruby.newProc方法的一些代码示例,展示了Ruby.newProc的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newProc方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newProc

Ruby.newProc介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

public RubyRunnable(RubyThread rubyThread, IRubyObject[] args, Block currentBlock) {
  this.rubyThread = rubyThread;
  this.runtime = rubyThread.getRuntime();
  proc = runtime.newProc(Block.Type.THREAD, currentBlock);
  this.arguments = args;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(module = true, visibility = PRIVATE)
public static RubyProc lambda(ThreadContext context, IRubyObject recv, Block block) {
  // If we encounter a amp'd proc we leave it a proc for some reason.
  Block.Type type = block.type == Block.Type.PROC ? block.type : Block.Type.LAMBDA;
  return context.runtime.newProc(type, block);
}

代码示例来源:origin: org.jruby/jruby-core

@Deprecated // not-used
public static void registerEndBlock(Block block, Ruby runtime) {
  runtime.pushExitBlock(runtime.newProc(Block.Type.LAMBDA, block));
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(module = true, visibility = PRIVATE)
public static RubyProc lambda(ThreadContext context, IRubyObject recv, Block block) {
  // If we encounter a amp'd proc we leave it a proc for some reason.
  Block.Type type = block.type == Block.Type.PROC ? block.type : Block.Type.LAMBDA;
  return context.runtime.newProc(type, block);
}

代码示例来源:origin: org.jruby/jruby-core

public RubyRunnable(RubyThread rubyThread, IRubyObject[] args, Block currentBlock) {
  this.rubyThread = rubyThread;
  this.runtime = rubyThread.getRuntime();
  proc = runtime.newProc(Block.Type.THREAD, currentBlock);
  this.arguments = args;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public RubyRunnable(RubyThread rubyThread, IRubyObject[] args, Block currentBlock) {
  this.rubyThread = rubyThread;
  this.runtime = rubyThread.getRuntime();
  
  proc = runtime.newProc(Block.Type.THREAD, currentBlock);
  this.arguments = args;
}

代码示例来源:origin: org.jruby/jruby-complete

public static IRubyObject newProc(Ruby runtime, Block block) {
  return (block == Block.NULL_BLOCK) ? runtime.getNil() : runtime.newProc(Block.Type.PROC, block);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public RubyRunnable(RubyThread rubyThread, IRubyObject[] args, Block currentBlock) {
  this.rubyThread = rubyThread;
  this.runtime = rubyThread.getRuntime();
  
  proc = runtime.newProc(Block.Type.THREAD, currentBlock);
  this.arguments = args;
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "proc", module = true, visibility = PRIVATE)
public static RubyProc proc(ThreadContext context, IRubyObject recv, Block block) {
  return context.runtime.newProc(Block.Type.PROC, block);
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(module = true, visibility = PRIVATE)
public static IRubyObject at_exit(ThreadContext context, IRubyObject recv, Block block) {
  return context.runtime.pushExitBlock(context.runtime.newProc(Block.Type.PROC, block));
}

代码示例来源:origin: org.jruby/jruby-core

@JIT
public static void pushExitBlock(ThreadContext context, Block blk) {
  context.runtime.pushEndBlock(context.runtime.newProc(LAMBDA, blk));
}

代码示例来源:origin: org.jruby/jruby-complete

@JIT
public static void pushExitBlock(ThreadContext context, Block blk) {
  context.runtime.pushEndBlock(context.runtime.newProc(LAMBDA, blk));
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, Block block) {
  Ruby runtime = context.runtime;
  if (!block.isGiven()) throw runtime.newLocalJumpErrorNoBlock();
  proc = runtime.newProc(Block.Type.PROC, block);
  return this;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, Block block) {
  Ruby runtime = context.runtime;
  if (!block.isGiven()) throw runtime.newLocalJumpErrorNoBlock();
  proc = runtime.newProc(Block.Type.PROC, block);
  return this;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, Block block) {
  Ruby runtime = context.runtime;
  if (!block.isGiven()) throw runtime.newLocalJumpErrorNoBlock();
  proc = runtime.newProc(Block.Type.PROC, block);
  return this;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, Block block) {
  Ruby runtime = context.runtime;
  if (!block.isGiven()) throw runtime.newLocalJumpErrorNoBlock();
  proc = runtime.newProc(Block.Type.PROC, block);
  return this;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
  public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    Block block = SharedScopeBlock.newInterpretedSharedScopeClosure(context, this, context.getCurrentScope(), self);
    
    runtime.pushExitBlock(runtime.newProc(Block.Type.LAMBDA, block));
    
    return runtime.getNil();
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
  public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    Block block = SharedScopeBlock.newInterpretedSharedScopeClosure(context, this, context.getCurrentScope(), self);
    
    runtime.pushExitBlock(runtime.newProc(Block.Type.LAMBDA, block));
    
    return runtime.getNil();
  }
}

代码示例来源: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);
}

相关文章

微信公众号

最新文章

更多

Ruby类方法