本文整理了Java中org.jruby.Ruby.getKCode
方法的一些代码示例,展示了Ruby.getKCode
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getKCode
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getKCode
暂无
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public IRubyObject get() {
return runtime.getKCode().kcode(runtime);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private Encoding getEncodingForKCodeDefault(Ruby runtime, Regex pattern, IRubyObject pat) {
Encoding enc = pattern.getEncoding();
if (enc != runtime.getKCode().getEncoding() && pat instanceof RubyRegexp) {
RubyRegexp regexp = (RubyRegexp) pat;
if (regexp.isKCodeDefault()) {
enc = runtime.getKCode().getEncoding();
}
}
return enc;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private Encoding getEncodingForKCodeDefault(Ruby runtime, Regex pattern, IRubyObject pat) {
Encoding enc = pattern.getEncoding();
if (enc != runtime.getKCode().getEncoding() && pat instanceof RubyRegexp) {
RubyRegexp regexp = (RubyRegexp) pat;
if (regexp.isKCodeDefault()) {
enc = runtime.getKCode().getEncoding();
}
}
return enc;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public IRubyObject get() {
String kcode = runtime.getKCode().getKCode();
return kcode == null ? runtime.getNil() : runtime.newString(kcode);
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public IRubyObject get() {
String kcode = runtime.getKCode().getKCode();
return kcode == null ? runtime.getNil() : runtime.newString(kcode);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public RubyRegexp loadPattern(Ruby runtime) {
// FIXME: 1.9 should care about internal or external encoding and not kcode.
if (pattern == null || runtime.getKCode() != pattern.getKCode()) {
setPattern(RubyRegexp.newRegexp(runtime, value, options));
}
return pattern;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public RubyRegexp loadPattern(Ruby runtime) {
// FIXME: 1.9 should care about internal or external encoding and not kcode.
if (pattern == null || runtime.getKCode() != pattern.getKCode()) {
setPattern(RubyRegexp.newRegexp(runtime, value, options));
}
return pattern;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public final RubyRegexp getRegexp(ThreadContext context, int index, ByteList pattern, int options) {
RubyRegexp regexp = regexps[index];
if (regexp == null || context.runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(context.runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
regexp.setLiteral();
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: org.jruby/jruby-complete
public final RubyRegexp getRegexp(ThreadContext context, int index, ByteList pattern, int options) {
RubyRegexp regexp = regexps[index];
if (regexp == null || context.runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(context.runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
regexp.setLiteral();
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public final RubyRegexp getRegexp(ThreadContext context, int index, ByteList pattern, int options) {
RubyRegexp regexp = regexps[index];
if (regexp == null || context.runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(context.runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
regexp.setLiteral();
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: org.jruby/jruby-core
public final RubyRegexp getRegexp(ThreadContext context, int index, ByteList pattern, int options) {
RubyRegexp regexp = regexps[index];
if (regexp == null || context.runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(context.runtime, pattern, RegexpOptions.fromEmbeddedOptions(options));
regexp.setLiteral();
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: org.jruby/jruby-core
public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
RubyRegexp regexp = regexps[index];
Ruby runtime = pattern.getRuntime();
if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
RubyRegexp regexp = regexps[index];
Ruby runtime = pattern.getRuntime();
if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: org.jruby/jruby-complete
public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
RubyRegexp regexp = regexps[index];
Ruby runtime = pattern.getRuntime();
if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
public final RubyRegexp cacheRegexp(int index, RubyString pattern, int options) {
RubyRegexp regexp = regexps[index];
Ruby runtime = pattern.getRuntime();
if (regexp == null || runtime.getKCode() != regexp.getKCode()) {
regexp = RubyRegexp.newRegexp(runtime, pattern.getByteList(), RegexpOptions.fromEmbeddedOptions(options));
regexps[index] = regexp;
}
return regexp;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private Encoding getEncoding(Ruby runtime, ByteList str) {
if (runtime.is1_9()) return str.getEncoding();
// Whatever $KCODE is we should use
if (options.isKcodeDefault()) return runtime.getKCode().getEncoding();
return options.getKCode().getEncoding();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private Encoding getEncoding(Ruby runtime, ByteList str) {
if (runtime.is1_9()) return str.getEncoding();
// Whatever $KCODE is we should use
if (options.isKcodeDefault()) return runtime.getKCode().getEncoding();
return options.getKCode().getEncoding();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private Regex getQuotedPattern(IRubyObject obj) {
if (obj instanceof RubyRegexp) return ((RubyRegexp)obj).getPattern();
Ruby runtime = getRuntime();
return RubyRegexp.getQuotedRegexpFromCache(runtime, getStringForPattern(obj).value, runtime.getKCode().getEncoding(), new RegexpOptions());
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private Regex getQuotedPattern(IRubyObject obj) {
if (obj instanceof RubyRegexp) return ((RubyRegexp)obj).getPattern();
Ruby runtime = getRuntime();
return RubyRegexp.getQuotedRegexpFromCache(runtime, getStringForPattern(obj).value, runtime.getKCode().getEncoding(), new RegexpOptions());
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private IRubyObject each_charCommon18(ThreadContext context, Block block) {
byte bytes[] = value.getUnsafeBytes();
int p = value.getBegin();
int end = p + value.getRealSize();
Ruby runtime = context.runtime;
Encoding enc = runtime.getKCode().getEncoding();
ByteList val = value.shallowDup();
while (p < end) {
int n = StringSupport.length(enc, bytes, p, end);
block.yield(context, makeShared19(runtime, val, p-val.getBegin(), n));
p += n;
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!