本文整理了Java中org.jruby.RubyModule.setClassVar
方法的一些代码示例,展示了RubyModule.setClassVar
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyModule.setClassVar
方法的具体详情如下:
包路径:org.jruby.RubyModule
类名称:RubyModule
方法名:setClassVar
[英]Set the named class variable to the given value, provided taint and freeze allow setting it. Ruby C equivalent = "rb_cvar_set"
[中]将命名的类变量设置为给定值,前提是允许设置污染和冻结。Ruby C equired=“rb_cvar_set”
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Deprecated
public IRubyObject fastSetClassVar(final String internedName, final IRubyObject value) {
return setClassVar(internedName, value);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Deprecated
public IRubyObject fastSetClassVar(final String internedName, final IRubyObject value) {
return setClassVar(internedName, value);
}
代码示例来源:origin: org.jruby/jruby-core
@Deprecated
public IRubyObject fastSetClassVar(final String internedName, final IRubyObject value) {
return setClassVar(internedName, value);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Injects a class variable value 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() {
RubyModule rubyClass = getRubyClass(receiver.getRuntime());
rubyClass.setClassVar(name, irubyObject);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static IRubyObject declareClassVariable(Ruby runtime, StaticScope scope, IRubyObject self, String name, IRubyObject value) {
// FIXME: This isn't quite right; it shouldn't evaluate the value if it's going to throw the error
RubyModule rubyClass = ASTInterpreter.getClassVariableBase(runtime, scope);
if (rubyClass == null) throw runtime.newTypeError("no class/module to define class variable");
rubyClass.setClassVar(name, value);
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
/** rb_mod_cvar_set
*
*/
public IRubyObject class_variable_set(IRubyObject name, IRubyObject value) {
return setClassVar(validateClassVariable(getRuntime(), name), value);
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Injects a class variable value 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.
*/
@Override
public void inject() {
RubyModule rubyClass = getRubyClass(receiver.getRuntime());
rubyClass.setClassVar(name, irubyObject);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self, IRubyObject value, Block block, boolean checkArity) {
ASTInterpreter.getClassVariableBase(context, runtime).setClassVar(name, value);
return runtime.getNil();
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public static IRubyObject declareClassVariable(Ruby runtime, StaticScope scope, IRubyObject self, String name, IRubyObject value) {
// FIXME: This isn't quite right; it shouldn't evaluate the value if it's going to throw the error
RubyModule rubyClass = ASTInterpreter.getClassVariableBase(runtime, scope);
if (rubyClass == null) throw runtime.newTypeError("no class/module to define class variable");
rubyClass.setClassVar(name, value);
return value;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Injects a class variable value 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() {
RubyModule rubyClass = getRubyClass(receiver.getRuntime());
rubyClass.setClassVar(name, irubyObject);
}
代码示例来源:origin: org.jruby/jruby-core
/** rb_mod_cvar_set
*
*/
public IRubyObject class_variable_set(IRubyObject name, IRubyObject value) {
return setClassVar(validateClassVariable(getRuntime(), name), value);
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Injects a class variable value 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.
*/
@Override
public void inject() {
RubyModule rubyClass = getRubyClass(receiver.getRuntime());
rubyClass.setClassVar(name, irubyObject);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** rb_mod_cvar_set
*
*/
@JRubyMethod(name = "class_variable_set", visibility = PRIVATE, compat = RUBY1_8)
public IRubyObject class_variable_set(IRubyObject var, IRubyObject value) {
return setClassVar(validateClassVariable(var.asJavaString()).intern(), value);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
RubyModule rubyClass = ASTInterpreter.getClassVariableBase(context, runtime);
if (rubyClass == null) rubyClass = self.getMetaClass();
return rubyClass.setClassVar(name, getValueNode().interpret(runtime, context, self, aBlock));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
RubyModule rubyClass = ASTInterpreter.getClassVariableBase(context, runtime);
if (rubyClass == null) {
throw runtime.newTypeError("no class/module to define class variable");
}
return rubyClass.setClassVar(name, getValueNode().interpret(runtime, context, self, aBlock));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
RubyModule rubyClass = ASTInterpreter.getClassVariableBase(context, runtime);
if (rubyClass == null) rubyClass = self.getMetaClass();
return rubyClass.setClassVar(name, getValueNode().interpret(runtime, context, self, aBlock));
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp);
RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp);
assert module != null : "MODULE should always be something";
// SSS FIXME: What is this check again???
// Modules and classes set this constant as a side-effect
if (!(getValue() instanceof CurrentScope)) module.setClassVar(getId(), value);
return null;
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
IRubyObject value = (IRubyObject) getValue().retrieve(context, self, currScope, currDynScope, temp);
RubyModule module = (RubyModule) getTarget().retrieve(context, self, currScope, currDynScope, temp);
assert module != null : "MODULE should always be something";
// SSS FIXME: What is this check again???
// Modules and classes set this constant as a side-effect
if (!(getValue() instanceof CurrentScope)) module.setClassVar(getId(), value);
return null;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self, IRubyObject value, Block block, boolean checkArity) {
if (runtime.isVerbose() && context.getRubyClass().isSingleton()) {
runtime.getWarnings().warn(ID.DECLARING_SCLASS_VARIABLE, getPosition(), "Declaring singleton class variable.");
}
ASTInterpreter.getClassVariableBase(context, runtime).setClassVar(name, value);
return runtime.getNil();
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self, IRubyObject value, Block block, boolean checkArity) {
if (runtime.isVerbose() && context.getRubyClass().isSingleton()) {
runtime.getWarnings().warn(ID.DECLARING_SCLASS_VARIABLE, getPosition(), "Declaring singleton class variable.");
}
ASTInterpreter.getClassVariableBase(context, runtime).setClassVar(name, value);
return runtime.getNil();
}
}
内容来源于网络,如有侵权,请联系作者删除!