예제 #1
0
  @Override
  public IRubyObject yieldSpecific(
      ThreadContext context,
      IRubyObject arg0,
      IRubyObject arg1,
      IRubyObject arg2,
      Binding binding,
      Block.Type type) {
    Visibility oldVis = binding.getFrame().getVisibility();
    Frame lastFrame = pre(context, null, binding);
    IRubyObject self = prepareSelf(binding);

    try {
      if (!noargblock) {
        assigner.assign(context.runtime, context, self, arg0, arg1, arg2, Block.NULL_BLOCK);
      }

      // This while loop is for restarting the block call in case a 'redo' fires.
      return evalBlockBody(context, binding, self);
    } catch (JumpException.FlowControlException jump) {
      return Helpers.handleBlockJump(context, jump, type);
    } finally {
      post(context, binding, oldVis, lastFrame);
    }
  }
예제 #2
0
  public IRubyObject yield(ThreadContext context, Binding binding, Block.Type type) {
    IRubyObject self = prepareSelf(binding);

    Visibility oldVis = binding.getFrame().getVisibility();
    Frame lastFrame = pre(context, null, binding);

    try {
      if (!noargblock) {
        assigner.assign(context.runtime, context, self, Block.NULL_BLOCK);
      }

      return evalBlockBody(context, binding, self);
    } catch (JumpException.FlowControlException jump) {
      return Helpers.handleBlockJump(context, jump, type);
    } finally {
      post(context, binding, oldVis, lastFrame);
    }
  }