@JRubyMethod public IRubyObject each(ThreadContext context, Block block) { for (IRubyObject key : table.keySet()) { block.yieldSpecific(context, key, table.get(key)); } return context.runtime.getNil(); }
@JRubyMethod(name = "each_oneof") public IRubyObject eachOneof(ThreadContext context, Block block) { for (RubyOneofDescriptor oneofDescriptor : oneofDefs.values()) { block.yieldSpecific(context, oneofDescriptor); } return context.runtime.getNil(); }
@JRubyMethod public IRubyObject each(ThreadContext context, Block block) { for (RubyFieldDescriptor field : fields) { block.yieldSpecific(context, field); } return context.runtime.getNil(); }
@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(); }
@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(); }
@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(); }
@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(); }
public static IRubyObject yieldSpecificFallback( Block block, ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) throws Throwable { return block.yieldSpecific(context, arg0, arg1, arg2); }
public static IRubyObject yieldSpecificFallback( Block block, ThreadContext context, IRubyObject arg0, IRubyObject arg1) throws Throwable { return block.yieldSpecific(context, arg0, arg1); }
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); } }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { return context.getCurrentFrame().getBlock().yieldSpecific(context); } }
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); } }
@JRubyMethod public IRubyObject synchronize(ThreadContext context, Block block) { lock(context); try { return block.yieldSpecific(context); } finally { unlock(context); } }
private void yieldRefineBlock(ThreadContext context, RubyModule refinement, Block block) { block.setEvalType(EvalType.MODULE_EVAL); block.getBinding().setSelf(refinement); block.yieldSpecific(context); }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { return context.getCurrentFrame().getBlock().yieldSpecific(context, argument1.interpret(runtime, context, self, aBlock)); } }
@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; }
private void yieldRefineBlock(ThreadContext context, RubyModule refinement, Block block) { block.setEvalType(EvalType.MODULE_EVAL); block.getBinding().setSelf(refinement); block.yieldSpecific(context); }
@JRubyMethod public IRubyObject synchronize(ThreadContext context, Block block) { lock(context); try { return block.yieldSpecific(context); } finally { unlock(context); } }
@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; }
@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; }