将 jruby 脚本路径替换为文件路径以外的其他抽象概念

发布于 2024-11-26 22:53:17 字数 781 浏览 0 评论 0原文

我只是猜测,但想要一些关于如何设置我自己的 ruby​​ 脚本加载器的评论,而不是仅仅让运行时采用文件路径。

我没有尝试加载脚本,但从阅读中会发现搜索的“脚本路径”是...

ScriptingContainer {

   /**
 * Changes a list of load paths Ruby scripts/libraries. The default value
 * is an empty array. If no paths is given, the list is created from
 * java.class.path System property. This value can be set by
 * org.jruby.embed.class.path System property, also.
 * Call this method before you use put/get, runScriptlet, and parse methods so that
 * the given paths will be used.
 *
 * @since JRuby 1.5.0.
 *
 * @param paths a new list of load paths.
 */
public void setLoadPaths(List<String> paths) {
    provider.getRubyInstanceConfig().setLoadPaths(paths);
}
}

我的理解是运行时需要文件路径,我希望能够从我自己的提供程序加载脚本,例如Apache 公共虚拟文件系统。

I am just guessing but would like some commentary about how to set my own ruby script loader rather than just letting the runtime take file paths.

I have not tried to load scripts, but from reading it would appear the "script path" that is searched is ...

ScriptingContainer {

   /**
 * Changes a list of load paths Ruby scripts/libraries. The default value
 * is an empty array. If no paths is given, the list is created from
 * java.class.path System property. This value can be set by
 * org.jruby.embed.class.path System property, also.
 * Call this method before you use put/get, runScriptlet, and parse methods so that
 * the given paths will be used.
 *
 * @since JRuby 1.5.0.
 *
 * @param paths a new list of load paths.
 */
public void setLoadPaths(List<String> paths) {
    provider.getRubyInstanceConfig().setLoadPaths(paths);
}
}

My understanding is the runtime expects file paths, i would like the ability to load scripts from my own provider such as a Apache commons Virtual FileSystem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文