org.jruby.runtime.Block.yieldSpecific()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(138)

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

Block.yieldSpecific介绍

暂无

代码示例

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod
public IRubyObject each(ThreadContext context, Block block) {
  for (IRubyObject key : table.keySet()) {
    block.yieldSpecific(context, key, table.get(key));
  }
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod(name = "each_oneof")
public IRubyObject eachOneof(ThreadContext context, Block block) {
  for (RubyOneofDescriptor oneofDescriptor : oneofDefs.values()) {
    block.yieldSpecific(context, oneofDescriptor);
  }
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod
public IRubyObject each(ThreadContext context, Block block) {
  for (RubyFieldDescriptor field : fields) {
    block.yieldSpecific(context, field);
  }
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod
public IRubyObject oneof(ThreadContext context, IRubyObject name, Block block) {
  RubyOneofDescriptor oneofdef = (RubyOneofDescriptor)
      cOneofDescriptor.newInstance(context, Block.NULL_BLOCK);
  RubyOneofBuilderContext ctx = (RubyOneofBuilderContext)
      cOneofBuilderContext.newInstance(context, oneofdef, Block.NULL_BLOCK);
  oneofdef.setName(context, name);
  Binding binding = block.getBinding();
  binding.setSelf(ctx);
  block.yieldSpecific(context);
  descriptor.addOneof(context, oneofdef);
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod
public IRubyObject build(ThreadContext context, Block block) {
  RubyBuilder ctx = (RubyBuilder) cBuilder.newInstance(context, Block.NULL_BLOCK);
  if (block.arity() == Arity.ONE_ARGUMENT) {
    block.yield(context, ctx);
  } else {
    Binding binding = block.getBinding();
    binding.setSelf(ctx);
    block.yieldSpecific(context);
  }
  ctx.finalizeToPool(context, this);
  buildFileDescriptor(context);
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod(name = "add_enum")
public IRubyObject addEnum(ThreadContext context, IRubyObject name, Block block) {
  RubyEnumDescriptor enumDef = (RubyEnumDescriptor) cEnumDescriptor.newInstance(context, Block.NULL_BLOCK);
  IRubyObject ctx = cEnumBuilderContext.newInstance(context, enumDef, Block.NULL_BLOCK);
  enumDef.setName(context, name);
  if (block.isGiven()) {
    if (block.arity() == Arity.ONE_ARGUMENT) {
      block.yield(context, ctx);
    } else {
      Binding binding = block.getBinding();
      binding.setSelf(ctx);
      block.yieldSpecific(context);
    }
  }
  this.pendingList.add(enumDef);
  return context.runtime.getNil();
}

代码示例来源:origin: bazelbuild/bazel

@JRubyMethod(name = "add_message")
public IRubyObject addMessage(ThreadContext context, IRubyObject name, Block block) {
  RubyDescriptor msgdef = (RubyDescriptor) cDescriptor.newInstance(context, Block.NULL_BLOCK);
  IRubyObject ctx = cMessageBuilderContext.newInstance(context, msgdef, this, Block.NULL_BLOCK);
  msgdef.setName(context, name);
  if (block.isGiven()) {
    if (block.arity() == Arity.ONE_ARGUMENT) {
      block.yield(context, ctx);
    } else {
      Binding binding = block.getBinding();
      binding.setSelf(ctx);
      block.yieldSpecific(context);
    }
  }
  this.pendingList.add(msgdef);
  return context.runtime.getNil();
}

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

public static IRubyObject yieldSpecificFallback(
    Block block,
    ThreadContext context,
    IRubyObject arg0,
    IRubyObject arg1,
    IRubyObject arg2) throws Throwable {
  return block.yieldSpecific(context, arg0, arg1, arg2);
}

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

public static IRubyObject yieldSpecificFallback(
    Block block,
    ThreadContext context,
    IRubyObject arg0,
    IRubyObject arg1) throws Throwable {
  return block.yieldSpecific(context, arg0, arg1);
}

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

private static IRubyObject modeExecute(final ThreadContext context, final RubyModule BigDecimal,
  final Block block, final String intVariableName) {
  IRubyObject current = BigDecimal.searchInternalModuleVariable(intVariableName);
  try {
    return block.yieldSpecific(context);
  }
  finally {
    BigDecimal.setInternalModuleVariable(intVariableName, current);
  }
}

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

@Override
  public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    return context.getCurrentFrame().getBlock().yieldSpecific(context);
  }
}

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

private static IRubyObject modeExecute(final ThreadContext context, final RubyModule BigDecimal,
  final Block block, final String intVariableName) {
  IRubyObject current = BigDecimal.searchInternalModuleVariable(intVariableName);
  try {
    return block.yieldSpecific(context);
  }
  finally {
    BigDecimal.setInternalModuleVariable(intVariableName, current);
  }
}

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

@JRubyMethod
public IRubyObject synchronize(ThreadContext context, Block block) {
  lock(context);
  try {
    return block.yieldSpecific(context);
  } finally {
    unlock(context);
  }
}

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

private void yieldRefineBlock(ThreadContext context, RubyModule refinement, Block block) {
  block.setEvalType(EvalType.MODULE_EVAL);
  block.getBinding().setSelf(refinement);
  block.yieldSpecific(context);
}

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

@Override
  public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    return context.getCurrentFrame().getBlock().yieldSpecific(context,
        argument1.interpret(runtime, context, self, aBlock));
  }
}

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

@JRubyMethod(name = "save_rounding_mode", meta = true)
public static IRubyObject save_rounding_mode(ThreadContext context, IRubyObject recv, Block block) {
  RubyModule c = (RubyModule)recv;
  IRubyObject nCur = c.searchInternalModuleVariable("vpRoundingMode");
  IRubyObject ret;
  try {
    ret = block.yieldSpecific(context);
  } finally {
    c.setInternalModuleVariable("vpRoundingMode", nCur);
  }
  return ret;
}

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

private void yieldRefineBlock(ThreadContext context, RubyModule refinement, Block block) {
  block.setEvalType(EvalType.MODULE_EVAL);
  block.getBinding().setSelf(refinement);
  block.yieldSpecific(context);
}

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

@JRubyMethod
public IRubyObject synchronize(ThreadContext context, Block block) {
  lock(context);
  try {
    return block.yieldSpecific(context);
  } finally {
    unlock(context);
  }
}

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

@JRubyMethod
public IRubyObject each_char(final ThreadContext context, final Block block) {
  if (!block.isGiven()) return enumeratorize(context.runtime, this, "each_char");
  IRubyObject c;
  while (!(c = getc(context)).isNil()) {
    block.yieldSpecific(context, c);
  }
  return this;
}

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

@JRubyMethod
public IRubyObject each_char(final ThreadContext context, final Block block) {
  if (!block.isGiven()) return enumeratorize(context.runtime, this, "each_char");
  IRubyObject c;
  while (!(c = getc(context)).isNil()) {
    block.yieldSpecific(context, c);
  }
  return this;
}

相关文章