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

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

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

Ruby.getStandardError介绍

暂无

代码示例

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

@Override
  public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) {
    return context.runtime.getStandardError();
  }
}

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

@Override
  public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) {
    return context.runtime.getStandardError();
  }
}

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

public RaiseException newStandardError(String message) {
  return newRaiseException(getStandardError(), message);
}

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

public RaiseException newStandardError(String message) {
  return newRaiseException(getStandardError(), message);
}

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

public RaiseException newStandardError(String message) {
  return newRaiseException(getStandardError(), message);
}

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

public RaiseException newStandardError(String message) {
  return newRaiseException(getStandardError(), message);
}

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

private IRubyObject[] getExceptions(RescueBodyNode cRescueNode, Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    Node exceptionNodes = cRescueNode.getExceptionNodes();
    IRubyObject[] exceptions;

    if (exceptionNodes == null) {
      exceptions = new IRubyObject[]{runtime.getStandardError()};
    } else {
      exceptions = ASTInterpreter.setupArgs(runtime, context, exceptionNodes, self, aBlock);
    }
    return exceptions;
  }
}

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

private IRubyObject[] getExceptions(RescueBodyNode cRescueNode, Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    Node exceptionNodes = cRescueNode.getExceptionNodes();
    IRubyObject[] exceptions;

    if (exceptionNodes == null) {
      exceptions = new IRubyObject[]{runtime.getStandardError()};
    } else {
      exceptions = ASTInterpreter.setupArgs(runtime, context, exceptionNodes, self, aBlock);
    }
    return exceptions;
  }
}

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

private boolean requiresBacktrace(ThreadContext context) {
  IRubyObject debugMode;
  // We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
  return context.exceptionRequiresBacktrace ||
      ((debugMode = context.runtime.getGlobalVariables().get("$DEBUG")) != null && debugMode.isTrue()) ||
      ! context.runtime.getStandardError().isInstance(exception);
}

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

private boolean requiresBacktrace(ThreadContext context) {
  IRubyObject debugMode;
  // We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
  return context.exceptionRequiresBacktrace ||
      ((debugMode = context.runtime.getGlobalVariables().get("$DEBUG")) != null && debugMode.isTrue()) ||
      ! context.runtime.getStandardError().isInstance(exception);
}

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

public void load(Ruby runtime, boolean wrap) throws IOException {
    RubyKernel.require(runtime.getKernel(), runtime.newString("delegate"), Block.NULL_BLOCK);
    RubyClass delegatorClass = (RubyClass) runtime.getClassFromPath("Delegator");
    RubyClass weakrefClass = runtime.defineClass("WeakRef", delegatorClass, WeakRef.WEAKREF_ALLOCATOR);
    weakrefClass.defineAnnotatedMethods(WeakRef.class);
    weakrefClass.defineClassUnder("RefError", runtime.getStandardError(), runtime.getStandardError().getAllocator());
  }
}

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

public void load(Ruby runtime, boolean wrap) throws IOException {
    RubyKernel.require(runtime.getKernel(), runtime.newString("delegate"), Block.NULL_BLOCK);
    RubyClass delegatorClass = (RubyClass) runtime.getClassFromPath("Delegator");
    RubyClass weakrefClass = runtime.defineClass("WeakRef", delegatorClass, WeakRef.WEAKREF_ALLOCATOR);
    weakrefClass.defineAnnotatedMethods(WeakRef.class);
    weakrefClass.defineClassUnder("RefError", runtime.getStandardError(), runtime.getStandardError().getAllocator());
  }
}

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

@JRubyMethod(name = "===", meta = true)
public static IRubyObject op_eqq(ThreadContext context, IRubyObject recv, IRubyObject other) {
  Ruby runtime = context.runtime;
  // special case non-FlowControlException Java exceptions so they'll be caught by rescue Exception
  if (other instanceof ConcreteJavaProxy &&
      (recv == runtime.getException() || recv == runtime.getStandardError())) {
    Object object = ((ConcreteJavaProxy)other).getObject();
    if (object instanceof Throwable && !(object instanceof FlowControlException)) {
      return context.runtime.getTrue();
    }
  }
  // fall back on default logic
  return ((RubyClass)recv).op_eqq(context, other);
}

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

@JRubyMethod(name = "===", meta = true)
public static IRubyObject op_eqq(ThreadContext context, IRubyObject recv, IRubyObject other) {
  Ruby runtime = context.runtime;
  // special case non-FlowControlException Java exceptions so they'll be caught by rescue Exception
  if (other instanceof ConcreteJavaProxy &&
      (recv == runtime.getException() || recv == runtime.getStandardError())) {
    Object object = ((ConcreteJavaProxy)other).getObject();
    if (object instanceof Throwable && !(object instanceof FlowControlException)) {
      return context.runtime.getTrue();
    }
  }
  // fall back on default logic
  return ((RubyClass)recv).op_eqq(context, other);
}

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

@JRubyMethod(name = "===", meta = true)
public static IRubyObject op_eqq(ThreadContext context, IRubyObject recv, IRubyObject other) {
  Ruby runtime = context.runtime;
  // special case non-FlowControlException Java exceptions so they'll be caught by rescue Exception
  if (other instanceof ConcreteJavaProxy &&
      (recv == runtime.getException() || recv == runtime.getStandardError())) {
    Object object = ((ConcreteJavaProxy)other).getObject();
    if (object instanceof Throwable && !(object instanceof FlowControlException)) {
      if (recv == runtime.getException() || object instanceof java.lang.Exception) {
        return context.tru;
      }
    }
  }
  // fall back on default logic
  return ((RubyClass)recv).op_eqq(context, other);
}

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

@JRubyMethod(name = "===", meta = true)
public static IRubyObject op_eqq(ThreadContext context, IRubyObject recv, IRubyObject other) {
  Ruby runtime = context.runtime;
  // special case non-FlowControlException Java exceptions so they'll be caught by rescue Exception
  if (other instanceof ConcreteJavaProxy &&
      (recv == runtime.getException() || recv == runtime.getStandardError())) {
    Object object = ((ConcreteJavaProxy)other).getObject();
    if (object instanceof Throwable && !(object instanceof FlowControlException)) {
      if (recv == runtime.getException() || object instanceof java.lang.Exception) {
        return context.tru;
      }
    }
  }
  // fall back on default logic
  return ((RubyClass)recv).op_eqq(context, other);
}

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

public static RubyClass createScannerClass(final Ruby runtime) {
  RubyClass scannerClass = runtime.defineClass("StringScanner", runtime.getObject(), STRINGSCANNER_ALLOCATOR);
  scannerClass.defineAnnotatedMethods(RubyStringScanner.class);
  ThreadContext context = runtime.getCurrentContext();
  scannerClass.setConstant("Version", runtime.newString("0.7.0").freeze(context));
  scannerClass.setConstant("Id", runtime.newString("$Id: strscan.c 13506 2007-09-24 08:56:24Z nobu $").freeze(context));
  RubyClass standardError = runtime.getStandardError();
  RubyClass error = scannerClass.defineClassUnder(
      "Error", standardError, standardError.getAllocator());
  RubyClass objClass = runtime.getObject();
  if (!objClass.isConstantDefined("ScanError")) {
    objClass.defineConstant("ScanError", error);
  }
  return scannerClass;
}

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

public static RubyClass createScannerClass(final Ruby runtime) {
  RubyClass scannerClass = runtime.defineClass("StringScanner", runtime.getObject(), STRINGSCANNER_ALLOCATOR);
  scannerClass.defineAnnotatedMethods(RubyStringScanner.class);
  ThreadContext context = runtime.getCurrentContext();
  scannerClass.setConstant("Version", runtime.newString("0.7.0").freeze(context));
  scannerClass.setConstant("Id", runtime.newString("$Id: strscan.c 13506 2007-09-24 08:56:24Z nobu $").freeze(context));
  RubyClass standardError = runtime.getStandardError();
  RubyClass error = scannerClass.defineClassUnder(
      "Error", standardError, standardError.getAllocator());
  RubyClass objClass = runtime.getObject();
  if (!objClass.isConstantDefined("ScanError")) {
    objClass.defineConstant("ScanError", error);
  }
  return scannerClass;
}

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

public static RubyClass createScannerClass(final Ruby runtime) {
  RubyClass scannerClass = runtime.defineClass("StringScanner", runtime.getObject(), STRINGSCANNER_ALLOCATOR);
  scannerClass.defineAnnotatedMethods(RubyStringScanner.class);
  ThreadContext context = runtime.getCurrentContext();
  scannerClass.setConstant("Version", runtime.newString("0.7.0").freeze(context));
  scannerClass.setConstant("Id", runtime.newString("$Id: strscan.c 13506 2007-09-24 08:56:24Z nobu $").freeze(context));
  RubyClass standardError = runtime.getStandardError();
  RubyClass error = scannerClass.defineClassUnder(
      "Error", standardError, standardError.getAllocator());
  RubyClass objClass = runtime.getObject();
  if (!objClass.isConstantDefined("ScanError")) {
    objClass.defineConstant("ScanError", error);
  }
  return scannerClass;
}

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

public static RubyClass createScannerClass(final Ruby runtime) {
  RubyClass scannerClass = runtime.defineClass("StringScanner", runtime.getObject(), STRINGSCANNER_ALLOCATOR);
  scannerClass.defineAnnotatedMethods(RubyStringScanner.class);
  ThreadContext context = runtime.getCurrentContext();
  scannerClass.setConstant("Version", runtime.newString("0.7.0").freeze(context));
  scannerClass.setConstant("Id", runtime.newString("$Id: strscan.c 13506 2007-09-24 08:56:24Z nobu $").freeze(context));
  RubyClass standardError = runtime.getStandardError();
  RubyClass error = scannerClass.defineClassUnder(
      "Error", standardError, standardError.getAllocator());
  RubyClass objClass = runtime.getObject();
  if (!objClass.isConstantDefined("ScanError")) {
    objClass.defineConstant("ScanError", error);
  }
  return scannerClass;
}

相关文章

微信公众号

最新文章

更多

Ruby类方法