org.jruby.Ruby.getKCode()方法的使用及代码示例

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

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

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;
}

相关文章

微信公众号

最新文章

更多

Ruby类方法