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

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

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

Ruby.runInterpreter介绍

[英]This is used for the "gets" loop, and we bypass 'load' to use an already-prepared, already-pushed scope for the script body.
[中]这用于“get”循环,我们绕过“load”,为脚本主体使用一个已经准备好、已经推送的作用域。

代码示例

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

/**
 * This is used for the "gets" loop, and we bypass 'load' to use an
 * already-prepared, already-pushed scope for the script body.
 */
public IRubyObject runInterpreterBody(Node scriptNode) {
  assert scriptNode != null : "scriptNode is not null";
  assert scriptNode instanceof RootNode : "scriptNode is not a RootNode";
  return runInterpreter(scriptNode);
}

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

/**
 * This is used for the "gets" loop, and we bypass 'load' to use an
 * already-prepared, already-pushed scope for the script body.
 */
public IRubyObject runInterpreterBody(Node scriptNode) {
  assert scriptNode != null : "scriptNode is not null";
  assert scriptNode instanceof RootNode : "scriptNode is not a RootNode";
  return runInterpreter(scriptNode);
}

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

public IRubyObject run() {
    return runtime.runInterpreter(node);
  }
}

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

public IRubyObject run() {
    return runtime.runInterpreter(node);
  }
}

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

public IRubyObject run() {
    return runtime.runInterpreter(node);
  }
}

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

public IRubyObject run() {
    return runtime.runInterpreter(node);
  }
}

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

/**
 * This is used for the "gets" loop, and we bypass 'load' to use an
 * already-prepared, already-pushed scope for the script body.
 */
public IRubyObject runInterpreterBody(Node scriptNode) {
  assert scriptNode != null : "scriptNode is not null";
  assert scriptNode instanceof RootNode : "scriptNode is not a RootNode";
  return runInterpreter(((RootNode) scriptNode).getBodyNode());
}

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

/**
 * This is used for the "gets" loop, and we bypass 'load' to use an
 * already-prepared, already-pushed scope for the script body.
 */
public IRubyObject runInterpreterBody(Node scriptNode) {
  assert scriptNode != null : "scriptNode is not null";
  assert scriptNode instanceof RootNode : "scriptNode is not a RootNode";
  return runInterpreter(((RootNode) scriptNode).getBodyNode());
}

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

public IRubyObject runInterpreter(ParseResult parseResult) {
  return runInterpreter(getCurrentContext(), parseResult, getTopSelf());
}

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

public IRubyObject runInterpreter(Node scriptNode) {
  return runInterpreter(getCurrentContext(), scriptNode, getTopSelf());
}

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

public IRubyObject runInterpreter(Node scriptNode) {
  return runInterpreter(getCurrentContext(), scriptNode, getTopSelf());
}

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

public IRubyObject runInterpreter(Node scriptNode) {
  return runInterpreter(getCurrentContext(), scriptNode, getTopSelf());
}

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

public IRubyObject runInterpreter(ParseResult parseResult) {
  return runInterpreter(getCurrentContext(), parseResult, getTopSelf());
}

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

public IRubyObject runInterpreter(Node scriptNode) {
  return runInterpreter(getCurrentContext(), scriptNode, getTopSelf());
}

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

/**
 * Parse and execute the specified script 
 * This differs from the other methods in that it accepts a string-based script and
 * parses and runs it as though it were loaded at a command-line. This is the preferred
 * way to start up a new script when calling directly into the Ruby object (which is
 * generally *dis*couraged.
 * 
 * @param script The contents of the script to run as a normal, root script
 * @return The last value of the script
 */
public IRubyObject executeScript(String script, String filename) {
  byte[] bytes = script.getBytes();
  Node node = parseInline(new ByteArrayInputStream(bytes), filename, null);
  ThreadContext context = getCurrentContext();
  
  String oldFile = context.getFile();
  int oldLine = context.getLine();
  try {
    context.setFileAndLine(node.getPosition());
    return runInterpreter(node);
  } finally {
    context.setFileAndLine(oldFile, oldLine);
  }
}

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

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(scriptName, in, null);
    // toss an anonymous module into the search path
    if (wrap) wrapWithModule((RubyBasicObject) self, parseResult);
    runInterpreter(context, parseResult, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

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

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? getTopSelf().rbClone() : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    ParseResult parseResult = parseFile(scriptName, in, null);
    // toss an anonymous module into the search path
    if (wrap) wrapWithModule((RubyBasicObject) self, parseResult);
    runInterpreter(context, parseResult, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

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

public void loadScope(IRScope scope, boolean wrap) {
  IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this, true) : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    if (wrap) {
      // toss an anonymous module into the search path
      scope.getStaticScope().setModule(RubyModule.newModule(this));
    }
    runInterpreter(context, scope, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

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

public void loadScope(IRScope scope, boolean wrap) {
  IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this, true) : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  try {
    ThreadContext.pushBacktrace(context, ROOT_FRAME_NAME, file, 0);
    context.preNodeEval(self);
    if (wrap) {
      // toss an anonymous module into the search path
      scope.getStaticScope().setModule(RubyModule.newModule(this));
    }
    runInterpreter(context, scope, self);
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

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

public void loadFile(String scriptName, InputStream in, boolean wrap) {
  IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
  ThreadContext context = getCurrentContext();
  String file = context.getFile();
  
  try {
    ThreadContext.pushBacktrace(context, "(root)", file, 0);
    context.preNodeEval(objectClass, self, scriptName);
    Node node = parseFile(in, scriptName, null);
    if (wrap) {
      // toss an anonymous module into the search path
      ((RootNode)node).getStaticScope().setModule(RubyModule.newModule(this));
    }
    runInterpreter(context, node, self);
  } catch (JumpException.ReturnJump rj) {
    return;
  } finally {
    context.postNodeEval();
    ThreadContext.popBacktrace(context);
  }
}

相关文章

微信公众号

最新文章

更多

Ruby类方法