本文整理汇总了Java中org.jruby.internal.runtime.GlobalVariable.Scope类的典型用法代码示例。如果您正苦于以下问题:Java Scope类的具体用法?Java Scope怎么用?Java Scope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Scope类属于org.jruby.internal.runtime.GlobalVariable包,在下文中一共展示了Scope类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defineVariable
import org.jruby.internal.runtime.GlobalVariable.Scope; //导入依赖的package包/类
private void defineVariable(String variable, String value) {
try {
GlobalVariable v = new GlobalVariable(interpreter, "$" + variable, interpreter.newString(value));
interpreter.defineVariable(v, Scope.GLOBAL);
} catch (Throwable t) {
throw new ScriptException("Unable to define variable " + variable + " value = " + value, t);
}
}
示例2: addEventHook
import org.jruby.internal.runtime.GlobalVariable.Scope; //导入依赖的package包/类
private void addEventHook() {
String script = "set_trace_func proc { |event, file, line, id, binding, classname| "
+ "$marathon_trace_func.event(event, file, java.lang.Integer.new(line), classname.to_s) }";
interpreter.defineReadonlyVariable("$marathon_trace_func", JavaEmbedUtils.javaToRuby(interpreter, this), Scope.GLOBAL);
interpreter.evalScriptlet(script);
}