本文整理了Java中org.jruby.Ruby.encodeToBytes
方法的一些代码示例,展示了Ruby.encodeToBytes
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.encodeToBytes
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:encodeToBytes
暂无
代码示例来源:origin: org.jruby/jruby-complete
public Node parseEval(String content, String file, DynamicScope scope, int lineNumber) {
addEvalParseToStats();
return parser.parse(file, encodeToBytes(content), scope, new ParserConfiguration(this, lineNumber, false, false, config));
}
代码示例来源:origin: org.jruby/jruby-core
public Node parseEval(String content, String file, DynamicScope scope, int lineNumber) {
addEvalParseToStats();
return parser.parse(file, encodeToBytes(content), scope, new ParserConfiguration(this, lineNumber, false, false, config));
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* 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 = encodeToBytes(script);
ParseResult root = (ParseResult) parseInline(new ByteArrayInputStream(bytes), filename, null);
ThreadContext context = getCurrentContext();
String oldFile = context.getFile();
int oldLine = context.getLine();
try {
context.setFileAndLine(root.getFile(), root.getLine());
return runInterpreter(root);
} finally {
context.setFileAndLine(oldFile, oldLine);
}
}
代码示例来源:origin: org.jruby/jruby-core
/**
* 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 = encodeToBytes(script);
ParseResult root = (ParseResult) parseInline(new ByteArrayInputStream(bytes), filename, null);
ThreadContext context = getCurrentContext();
String oldFile = context.getFile();
int oldLine = context.getLine();
try {
context.setFileAndLine(root.getFile(), root.getLine());
return runInterpreter(root);
} finally {
context.setFileAndLine(oldFile, oldLine);
}
}
内容来源于网络,如有侵权,请联系作者删除!