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

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

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

Ruby.newStopIteration介绍

[英]Generate a StopIteration exception. This differs from the normal logic by avoiding the generation of a backtrace. StopIteration is used by Enumerator to end an external iteration, and so generating a full backtrace is usually unreasonable overhead. The flag -Xstop_iteration.backtrace=true or the property jruby.stop_iteration.backtrace=true forces all StopIteration exceptions to generate a backtrace.
[中]生成StopIteration异常。这与正常逻辑不同,因为它避免了回溯的生成。枚举器使用StopIteration结束外部迭代,因此生成完整回溯通常是不合理的开销。标志-Xstop_迭代。backtrace=true或属性jruby。停止迭代。backtrace=true强制所有StopIteration异常生成回溯。

代码示例

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

@Deprecated
public RaiseException newLightweightStopIterationError(String message) {
  return newStopIteration(null, message);
}

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

@Deprecated
public RaiseException newLightweightStopIterationError(String message) {
  return newStopIteration(null, message);
}

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

private void checkIndex() throws RaiseException {
  if ( ! hasNext() ) throw runtime.newStopIteration(array, null);
}

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

private void checkIndex() throws RaiseException {
  if ( ! hasNext() ) throw runtime.newStopIteration(array, null);
}

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

private IRubyObject returnValue(IRubyObject value, final boolean silent) {
  // if it's the NEVER object, raise StopIteration
  if (value == NEVER) {
    doneObject = value;
    if ( silent ) return null;
    throw runtime.newStopIteration(stopValue, "iteration reached an end");
  }
  // if it's an exception, raise it
  if (value instanceof RubyException) {
    doneObject = value;
    if ( silent ) return null;
    throw ((RubyException) value).toThrowable();
  }
  // otherwise, just return it
  return value;
}

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

private IRubyObject returnValue(IRubyObject value, final boolean silent) {
  // if it's the NEVER object, raise StopIteration
  if (value == NEVER) {
    doneObject = value;
    if ( silent ) return null;
    throw runtime.newStopIteration(stopValue, "iteration reached an end");
  }
  // if it's an exception, raise it
  if (value instanceof RubyException) {
    doneObject = value;
    if ( silent ) return null;
    throw ((RubyException) value).toThrowable();
  }
  // otherwise, just return it
  return value;
}

相关文章

Ruby类方法