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

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

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

Ruby.newFrozenError介绍

暂无

代码示例

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

private void raiseFrozenError() throws RaiseException {
  if (this instanceof RubyModule) {
    throw getRuntime().newFrozenError("class/module ");
  } else {
    throw getRuntime().newFrozenError("");
  }
}

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

protected final void ensureClassVariablesSettable() {
  Ruby runtime = getRuntime();
  
  if (!isFrozen()) {
    return;
  }
  if (this instanceof RubyModule) {
    throw runtime.newFrozenError(ERR_FROZEN_CONST_TYPE);
  } else {
    throw runtime.newFrozenError("");
  }
}

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

private void raiseFrozenError() throws RaiseException {
  if (this instanceof RubyModule) {
    throw getRuntime().newFrozenError("class/module ");
  } else {
    throw getRuntime().newFrozenError(getMetaClass());
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen() {
  if (isFrozen()) {
    throw getRuntime().newFrozenError("object");
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen() {
  if (isFrozen()) {
    throw getRuntime().newFrozenError("object");
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen() {
  if (isFrozen()) {
    throw getRuntime().newFrozenError("object");
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen(String message) {
  if (isFrozen()) {
    throw getRuntime().newFrozenError(message);
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen(String message) {
  if (isFrozen()) {
    throw getRuntime().newFrozenError(message);
  }
}

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

/** rb_frozen_class_p
 *
 * Helper to test whether this object is frozen, and if it is will
 * throw an exception based on the message.
 */
protected final void testFrozen(String message) {
  if (isFrozen()) {
    throw getRuntime().newFrozenError(message);
  }
}

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

@Override
public final void checkFrozen() {
  if ( isFrozen() ) {
    throw getRuntime().newFrozenError(isClass() ? "class" : "module");
  }
}

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

/** rb_ary_modify_check
 *
 */
private final void modifyCheck() {
  if ((flags & TMPLOCK_OR_FROZEN_ARR_F) != 0) {
    if ((flags & FROZEN_F) != 0) throw getRuntime().newFrozenError("array");           
    if ((flags & TMPLOCK_ARR_F) != 0) throw getRuntime().newTypeError("can't modify array during iteration");
  }
}

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

/** rb_ary_modify_check
 *
 */
private final void modifyCheck() {
  if ((flags & TMPLOCK_OR_FROZEN_ARR_F) != 0) {
    if ((flags & FROZEN_F) != 0) throw getRuntime().newFrozenError("array");           
    if ((flags & TMPLOCK_ARR_F) != 0) throw getRuntime().newTypeError("can't modify array during iteration");
  }
}

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

@Override
public final void checkFrozen() {
  if ( isFrozen() ) {
    throw getRuntime().newFrozenError(isClass() ? "class" : "module");
  }
}

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

private RubyTime adjustTimeZone(Ruby runtime, final DateTimeZone zone) {
  if (zone.equals(dt.getZone())) return this;
  if (isFrozen()) {
    throw runtime.newFrozenError("Time", true);
  }
  dt = dt.withZone(zone);
  return this;
}

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

/** rb_ary_modify_check
 *
 */
protected final void modifyCheck() {
  if ((flags & TMPLOCK_OR_FROZEN_ARR_F) != 0) {
    if ((flags & FROZEN_F) != 0) throw getRuntime().newFrozenError(this.getMetaClass());
    if ((flags & TMPLOCK_ARR_F) != 0) throw getRuntime().newTypeError("can't modify array during iteration");
  }
}

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

private RubyTime adjustTimeZone(Ruby runtime, final DateTimeZone zone) {
  if (zone.equals(dt.getZone())) return this;
  if (isFrozen()) {
    throw runtime.newFrozenError("Time", true);
  }
  dt = dt.withZone(zone);
  return this;
}

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

/** rb_ary_modify_check
 *
 */
protected final void modifyCheck() {
  if ((flags & TMPLOCK_OR_FROZEN_ARR_F) != 0) {
    if ((flags & FROZEN_F) != 0) throw getRuntime().newFrozenError(this.getMetaClass());
    if ((flags & TMPLOCK_ARR_F) != 0) throw getRuntime().newTypeError("can't modify array during iteration");
  }
}

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

public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException {
  if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) {
    throw runtime.newTypeError("can't define singleton method \"" + name + "\" for " + receiver.getMetaClass().getBaseName());
  }
  if (receiver.isFrozen()) {
    throw runtime.newFrozenError("object");
  }
  
  RubyClass rubyClass = receiver.getSingletonClass();
  
  return rubyClass;
}

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

public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException {
  if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) {
    throw runtime.newTypeError(str(runtime, "can't define singleton method \"", ids(runtime, name), "\" for ", types(runtime, receiver.getMetaClass())));
  }
  if (receiver.isFrozen()) {
    throw runtime.newFrozenError("object");
  }
  RubyClass rubyClass = receiver.getSingletonClass();
  return rubyClass;
}

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

public static RubyClass performSingletonMethodChecks(Ruby runtime, IRubyObject receiver, String name) throws RaiseException {
  if (receiver instanceof RubyFixnum || receiver instanceof RubySymbol) {
    throw runtime.newTypeError(str(runtime, "can't define singleton method \"", ids(runtime, name), "\" for ", types(runtime, receiver.getMetaClass())));
  }
  if (receiver.isFrozen()) {
    throw runtime.newFrozenError("object");
  }
  RubyClass rubyClass = receiver.getSingletonClass();
  return rubyClass;
}

相关文章

微信公众号

最新文章

更多

Ruby类方法