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

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

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

Ruby.is1_8介绍

暂无

代码示例

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private static String toPathMethod(Ruby runtime) {
  return runtime.is1_8() ? "to_str" : "to_path";
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private static String toPathMethod(Ruby runtime) {
  return runtime.is1_8() ? "to_str" : "to_path";
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

public void load(Ruby runtime, boolean wrap) {
  assert !runtime.is1_8() : "the native delegator extension is not compatible with 1.8";
  
  RubyClass delegateClass = runtime.getClass("Delegator");
  delegateClass.defineAnnotatedMethods(NativeDelegateLibrary.class);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

public void load(Ruby runtime, boolean wrap) {
  assert !runtime.is1_8() : "the native delegator extension is not compatible with 1.8";
  
  RubyClass delegateClass = runtime.getClass("Delegator");
  delegateClass.defineAnnotatedMethods(NativeDelegateLibrary.class);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private boolean isEOF() {
  return isEndOfString() || (getRuntime().is1_8() && ptr.eof);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private boolean isEOF() {
  return isEndOfString() || (getRuntime().is1_8() && ptr.eof);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private RubySymbol checkSpecialCasesIntern(ByteList value) {
  String[][] opTable = getRuntime().is1_8() ? opTable18 : opTable19;
  
  for (int i = 0; i < opTable.length; i++) {
    String op = opTable[i][1];
    if (value.toString().equals(op)) {
      return getRuntime().getSymbolTable().getSymbol(opTable[i][0]);
    }
  }
  
  return null;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private RubySymbol checkSpecialCasesIntern(ByteList value) {
  String[][] opTable = getRuntime().is1_8() ? opTable18 : opTable19;
  
  for (int i = 0; i < opTable.length; i++) {
    String op = opTable[i][1];
    if (value.toString().equals(op)) {
      return getRuntime().getSymbolTable().getSymbol(opTable[i][0]);
    }
  }
  
  return null;
}

代码示例来源:origin: org.jruby/jruby-complete

private static long convertTimeout(final ThreadContext context, IRubyObject timeoutArg) {
    final long timeout;
    if (timeoutArg instanceof RubyFloat) {
      timeout = Math.round(((RubyFloat) timeoutArg).getDoubleValue() * 1000);
    }
    else if (timeoutArg instanceof RubyInteger) {
      timeout = Math.round(((RubyInteger) timeoutArg).getDoubleValue() * 1000);
    }
    else {
      final Ruby runtime = context.runtime;
      if ( ! runtime.is1_8() ) {
        RubyFloat t = null;
        try {
          t = timeoutArg.callMethod(context, "to_f").convertToFloat();
        }
        catch (RaiseException e) { /* fallback to TypeError */ }

        timeout = t != null ? Math.round(t.getDoubleValue() * 1000) : -1;
      }
      else timeout = -1;
      if ( timeout == -1 ) {
        throw runtime.newTypeError("can't convert " + timeoutArg.getMetaClass().getName() + " into time interval");
      }
    }

    if ( timeout < 0 ) throw context.runtime.newArgumentError("negative timeout given");
    return timeout;
}

代码示例来源:origin: org.jruby/jruby-core

private static long convertTimeout(final ThreadContext context, IRubyObject timeoutArg) {
    final long timeout;
    if (timeoutArg instanceof RubyFloat) {
      timeout = Math.round(((RubyFloat) timeoutArg).getDoubleValue() * 1000);
    }
    else if (timeoutArg instanceof RubyInteger) {
      timeout = Math.round(((RubyInteger) timeoutArg).getDoubleValue() * 1000);
    }
    else {
      final Ruby runtime = context.runtime;
      if ( ! runtime.is1_8() ) {
        RubyFloat t = null;
        try {
          t = timeoutArg.callMethod(context, "to_f").convertToFloat();
        }
        catch (RaiseException e) { /* fallback to TypeError */ }

        timeout = t != null ? Math.round(t.getDoubleValue() * 1000) : -1;
      }
      else timeout = -1;
      if ( timeout == -1 ) {
        throw runtime.newTypeError("can't convert " + timeoutArg.getMetaClass().getName() + " into time interval");
      }
    }

    if ( timeout < 0 ) throw context.runtime.newArgumentError("negative timeout given");
    return timeout;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  ptr.pos = RubyNumeric.fix2int(arg);
  
  if (ptr.pos < 0) throw getRuntime().newErrnoEINVALError("Invalid argument");
  if (getRuntime().is1_8() && !isEndOfString()) ptr.eof = false;
  return getRuntime().getNil();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject arg) {
  ptr.pos = RubyNumeric.fix2int(arg);
  
  if (ptr.pos < 0) throw getRuntime().newErrnoEINVALError("Invalid argument");
  if (getRuntime().is1_8() && !isEndOfString()) ptr.eof = false;
  return getRuntime().getNil();
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

if (runtime.is1_8()) {
  if (0 <= year && year < 39) {
    year += 2000;

相关文章

微信公众号

最新文章

更多

Ruby类方法