本文整理了Java中org.jruby.Ruby.fastNewSymbol
方法的一些代码示例,展示了Ruby.fastNewSymbol
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.fastNewSymbol
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:fastNewSymbol
[英]Faster than #newSymbol(String) if you already have an interned name String. Don't intern your string just to call this version - the overhead of interning will more than wipe out any benefit from the faster lookup.
[中]比#newSymbol(String)快,如果你已经有了一个实习生姓名字符串。不要仅仅为了调用这个版本而对字符串进行实习生——实习生的开销将超过更快查找带来的任何好处。
代码示例来源:origin: org.jruby/jruby-core
private RubySymbol getSymbolicName(ThreadContext context) {
RubySymbol symbolicName = this.symbolicName;
if (symbolicName != null) return symbolicName;
return this.symbolicName = context.runtime.fastNewSymbol(name);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RubySymbol getSymbol(Ruby runtime) {
RubySymbol sym;
if ((sym = symbol) != null) return sym;
return symbol = runtime.fastNewSymbol(name);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RubySymbol getSymbol(Ruby runtime) {
RubySymbol sym;
if ((sym = symbol) != null) return sym;
return symbol = runtime.fastNewSymbol(name);
}
代码示例来源:origin: org.jruby/jruby-complete
private RubySymbol getSymbolicName(ThreadContext context) {
RubySymbol symbolicName = this.symbolicName;
if (symbolicName != null) return symbolicName;
return this.symbolicName = context.runtime.fastNewSymbol(name);
}
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated
public static RubySymbol addInstanceMethod(RubyModule containingClass, String name, DynamicMethod method, Visibility visibility, ThreadContext context, Ruby runtime) {
return addInstanceMethod(containingClass, runtime.fastNewSymbol(name), method, visibility, context, runtime);
}
代码示例来源:origin: org.jruby/jruby-core
@Deprecated
public static RubySymbol addInstanceMethod(RubyModule containingClass, String name, DynamicMethod method, Visibility visibility, ThreadContext context, Ruby runtime) {
return addInstanceMethod(containingClass, runtime.fastNewSymbol(name), method, visibility, context, runtime);
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Transform object into an Enumerator with the given size
*/
public static IRubyObject enumeratorizeWithSize(ThreadContext context, final IRubyObject object, String method, IRubyObject[] args, SizeFn sizeFn) {
Ruby runtime = context.runtime;
return new RubyEnumerator(runtime, runtime.getEnumerator(), object, runtime.fastNewSymbol(method), args, sizeFn);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) {
RubyModule module = (RubyModule) receiver.retrieve(context, self, currDynScope, temp);
return module.callMethod(context, "const_missing", context.runtime.fastNewSymbol(missingConst));
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public Object interpret(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, Block block) {
RubyModule module = (RubyModule) receiver.retrieve(context, self, currDynScope, temp);
return module.callMethod(context, "const_missing", context.runtime.fastNewSymbol(missingConst));
}
代码示例来源:origin: org.jruby/jruby-complete
public static IRubyObject enumeratorizeWithSize(ThreadContext context, IRubyObject object, String method,IRubyObject arg, IRubyObject size) {
Ruby runtime = context.runtime;
return new RubyEnumerator(runtime, runtime.getEnumerator(), object, runtime.fastNewSymbol(method), new IRubyObject[] { arg }, size);
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Transform object into an Enumerator with the given size
*/
public static IRubyObject enumeratorizeWithSize(ThreadContext context, final IRubyObject object, String method, IRubyObject[] args, SizeFn sizeFn) {
Ruby runtime = context.runtime;
return new RubyEnumerator(runtime, runtime.getEnumerator(), object, runtime.fastNewSymbol(method), args, sizeFn);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(name = "initialize", visibility = PRIVATE, compat = RUBY1_9)
public IRubyObject initialize19(ThreadContext context, IRubyObject object, Block block) {
return initialize(object, context.runtime.fastNewSymbol("each"), NULL_ARRAY);
}
代码示例来源:origin: org.jruby/jruby-complete
public final IRubyObject getConstant(ThreadContext context, StaticScope scope, String name, int index) {
IRubyObject value = getValue(context, scope, name, index);
// We can callsite cache const_missing if we want
return value != null ? value : scope.getModule().callMethod(context, "const_missing", context.runtime.fastNewSymbol(name));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public static void addInstanceMethod(RubyModule containingClass, String name, DynamicMethod method, Visibility visibility, ThreadContext context, Ruby runtime) {
containingClass.addMethod(name, method);
RubySymbol sym = runtime.fastNewSymbol(name);
if (visibility == Visibility.MODULE_FUNCTION) {
addModuleMethod(containingClass, name, method, context, sym);
}
callNormalMethodHook(containingClass, context, sym);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public final IRubyObject getConstant(ThreadContext context, StaticScope scope, String name, int index) {
IRubyObject value = getValue(context, scope, name, index);
// We can callsite cache const_missing if we want
return value != null ? value : scope.getModule().callMethod(context, "const_missing", context.runtime.fastNewSymbol(name));
}
代码示例来源:origin: org.jruby/jruby-core
public final IRubyObject getConstant(ThreadContext context, StaticScope scope, String name, int index) {
IRubyObject value = getValue(context, scope, name, index);
// We can callsite cache const_missing if we want
return value != null ? value : scope.getModule().callMethod(context, "const_missing", context.runtime.fastNewSymbol(name));
}
代码示例来源:origin: org.jruby/jruby-complete
public IRubyObject getConstantFromConstMissing(String name) {
return callMethod(getRuntime().getCurrentContext(),
"const_missing", getRuntime().fastNewSymbol(name));
}
代码示例来源:origin: org.jruby/jruby-core
public IRubyObject getConstantFromConstMissing(String name) {
return callMethod(getRuntime().getCurrentContext(),
"const_missing", getRuntime().fastNewSymbol(name));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public IRubyObject getConstantFromConstMissing(String name) {
return callMethod(getRuntime().getCurrentContext(),
"const_missing", getRuntime().fastNewSymbol(name));
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
IRubyObject value = getValue(context);
// We can callsite cache const_missing if we want
return value != null ? value :
context.getCurrentScope().getStaticScope().getModule().callMethod(context, "const_missing", runtime.fastNewSymbol(name));
}
内容来源于网络,如有侵权,请联系作者删除!