org.jruby.RubyModule.storeConstant()方法的使用及代码示例

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

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

RubyModule.storeConstant介绍

暂无

代码示例

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

@Deprecated
public IRubyObject fastStoreConstant(String internedName, IRubyObject value) {
  return storeConstant(internedName, value);
}

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

@Deprecated
public IRubyObject fastStoreConstant(String internedName, IRubyObject value) {
  return storeConstant(internedName, value);
}

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

@Deprecated
public IRubyObject fastStoreConstant(String internedName, IRubyObject value) {
  return storeConstant(internedName, value);
}

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

@Deprecated
public IRubyObject fastStoreConstant(String internedName, IRubyObject value) {
  return storeConstant(internedName, value);
}

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

public final void setConstantVisibility(Ruby runtime, String name, boolean hidden) {
  ConstantEntry entry = getConstantMap().get(name);
  if (entry == null) {
    throw runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
  }
  storeConstant(name, entry.value, hidden);
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private void setAutoloadConstant(String name, IRubyObject value) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
      storeConstant(name, value);
      removeAutoload(name);
    }
  } else {
    storeConstant(name, value);
  }
}

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

public final void setConstantVisibility(Ruby runtime, String name, boolean hidden) {
  ConstantEntry entry = getConstantMap().get(name);
  if (entry == null) {
    throw runtime.newNameError("constant " + getName() + "::" + name + " not defined", name);
  }
  storeConstant(name, entry.value, hidden);
}

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

/**
 * Set an Object as a defined constant in autoloading.
 */
private void setAutoloadConstant(String name, IRubyObject value) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    if (!autoload.setConstant(getRuntime().getCurrentContext(), value)) {
      storeConstant(name, value);
      removeAutoload(name);
    }
  } else {
    storeConstant(name, value);
  }
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected final void defineAutoload(String name, AutoloadMethod loadMethod) {
  final Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected void defineAutoload(String name, IAutoloadMethod loadMethod) {
  Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected IRubyObject finishAutoload(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    IRubyObject value = autoload.getValue();
    if (value != null) {
      storeConstant(name, value);
    }
    removeAutoload(name);
    return value;
  }
  return null;
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected void defineAutoload(String name, IAutoloadMethod loadMethod) {
  Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

/**
 * Define an autoload. ConstantMap holds UNDEF for the name as an autoload marker.
 */
protected final void defineAutoload(String name, AutoloadMethod loadMethod) {
  final Autoload existingAutoload = getAutoloadMap().get(name);
  if (existingAutoload == null || existingAutoload.getValue() == null) {
    storeConstant(name, RubyObject.UNDEF);
    getAutoloadMapForWrite().put(name, new Autoload(loadMethod));
  }
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected IRubyObject finishAutoload(String name) {
  Autoload autoload = getAutoloadMap().get(name);
  if (autoload != null) {
    IRubyObject value = autoload.getValue();
    if (value != null) {
      storeConstant(name, value);
    }
    removeAutoload(name);
    return value;
  }
  return null;
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected final IRubyObject finishAutoload(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  final IRubyObject value = autoload.getValue();
  if ( value != null ) {
    storeConstant(name, value);
  }
  removeAutoload(name);
  invalidateConstantCache(name);
  return value;
}

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

/**
 * Extract an Object which is defined by autoload thread from autoloadMap and define it as a constant.
 */
protected final IRubyObject finishAutoload(String name) {
  final Autoload autoload = getAutoloadMap().get(name);
  if ( autoload == null ) return null;
  final IRubyObject value = autoload.getValue();
  if ( value != null ) {
    storeConstant(name, value);
  }
  removeAutoload(name);
  invalidateConstantCache(name);
  return value;
}

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

public void deprecateConstant(Ruby runtime, String name) {
  ConstantEntry entry = getConstantMap().get(name);
  if (entry == null) {
    throw runtime.newNameError(str(runtime, "constant ", types(runtime, this), "::", ids(runtime, name), " not defined"), name);
  }
  storeConstant(name, entry.value, entry.hidden, true);
  invalidateConstantCache(name);
}

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

public void deprecateConstant(Ruby runtime, String name) {
  ConstantEntry entry = getConstantMap().get(name);
  if (entry == null) {
    throw runtime.newNameError(str(runtime, "constant ", types(runtime, this), "::", ids(runtime, name), " not defined"), name);
  }
  storeConstant(name, entry.value, entry.hidden, true);
  invalidateConstantCache(name);
}

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

/**
 * Injects ARGV values to a parsed Ruby script. This method is
 * invoked during EvalUnit#run() is executed.
 *
 * @param runtime is environment where a variable injection occurs
 * @param receiver is the instance that will have variable injection.
 */
public void inject() {
  updateArgvByJavaObject();
  RubyModule rubyModule = getRubyClass(receiver.getRuntime());
  if (rubyModule == null) rubyModule = receiver.getRuntime().getCurrentContext().getRubyClass();
  if (rubyModule == null) return;
  rubyModule.storeConstant(name, irubyObject);
  receiver.getRuntime().getConstantInvalidator(name).invalidate();
  fromRuby = true;
}

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

/**
 * Injects a constant value to a parsed Ruby script. This method is
 * invoked during EvalUnit#run() is executed.
 */
public void inject() {
  if (receiver == receiver.getRuntime().getTopSelf()) {
    RubyModule rubyModule = getRubyClass(receiver.getRuntime());
    if (rubyModule == null) rubyModule = receiver.getRuntime().getCurrentContext().getRubyClass();
    if (rubyModule == null) return;
    rubyModule.storeConstant(name, irubyObject);
  } else {
    receiver.getMetaClass().storeConstant(name, irubyObject);
  }
  receiver.getRuntime().getConstantInvalidator(name).invalidate();
  initialized = true;
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法