罗德岛的 HTTparty

发布于 2024-10-22 06:08:50 字数 134 浏览 3 评论 0原文

我正在使用 Rhodes 开发 Android 应用程序。 我已经在罗德安装了 HTTpary gem。现在,当我在应用程序顶部编写语句“require 'httparty'”时,它会给我错误,例如“没有要加载的文件”。 我应该怎么做才能解决这个问题?

I am using Rhodes to develop android application.
I have installed HTTpary gem in Rhodes. Now when I am writing the statement "require 'httparty' " at top of the application it gives me error like "No such file to load".
What should I do to solve this problem?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

落叶缤纷 2024-10-29 06:08:50

文档中,向下滚动到以“将 Ruby 扩展库添加到您的罗德应用”。它详细介绍了将外部库包含到应用程序中的 3 种方法,总结如下。

  1. 将 ruby​​ 扩展添加到单个应用程序
  2. 将 ruby​​ 库添加到单个应用程序
  3. 将 ruby​​ 库添加到要为所有应用程序构建的 Rhodes 框架

基本 Rhodes 框架仅包含被认为足够通用的内容 - 因此可以保留构建的应用程序包大小低的。任何不在基础框架中的东西都可以通过上述方法包含在应用程序中。

From the documentation, scroll down to the section beginning "Adding Ruby Extension Libraries to Your Rhodes Application". It details 3 ways you can include external libraries into your application, summarized below.

  1. Add ruby extension to an individual application
  2. Add ruby library to an individual application
  3. Add ruby library to the Rhodes framework to be built for all applications

The base Rhodes framework only contains things deemed generic enough to be included - so the built application package size can be kept low. Anything not in the base framework can be included in the application through the aforementioned methods.

≈。彩虹 2024-10-29 06:08:50

这只是一个猜测,因为有罗德环境;但如果这是一个普通的 ruby​​ 脚本,您首先需要 require 'rubygems' (假设您使用 ruby​​gems...)。

This is just a guess since w/ Rhodes environment; but if this were a normal ruby script you would need to have require 'rubygems' first (assuming your used rubygems...).

看春风乍起 2024-10-29 06:08:50

摩托罗拉的文档非常糟糕;如果可以的话请允许我帮忙。首先,检查 Ruby 代码中的常量 $LOAD_PATHS 以查看 Rhodes 搜索的完整路径列表。此路径中的任何 .rb 文件都会自动可供 require 使用。

然后你必须决定是将该库添加到整个 Rhodes 框架还是仅添加到你的应用程序中;就我个人而言,我一次选择一个应用程序,因为这样可以减少不兼容的可能性,并且您的应用程序仍然会提供 rhodes-*version/lib/framework 中的所有库(

如果您想添加)一个库到您的应用程序,文档建议将其放入目录 app/lib 中,但请记住,仅搜索这个确切的路径,因此如果您没有.rb 与你的 require 语句同名的文件直接在此路径下,它不会被自动检测到。 我提到这一点是因为常见的结构是单个文件,库名称直接放置在 lib 中,以及同名文件夹中的实际库内容。

示例:mime-types 库由:lib/mime-types.rblib/mime/ 组成,它们的命名不同当包含在 Ruby 中时,可能会导致这种混乱。

The Motorola documentation is horrendous; allow me to help if I can. Firstly, examine the constant $LOAD_PATHS from your Ruby code to see the entire list of paths that Rhodes searches. Any .rb file in this path is automatically made available to require.

Then you have to decide whether to add this library to the entire Rhodes framework or just your app; personally I opt for one app at a time, because that way it reduces the chances of incompatibilities, and your apps are still provided all the libraries in rhodes-*version/lib/framework

If you want to add a library to your app, the docs suggest plopping it into the directory app/lib, but keep in mind that only this exact path is searched, so if you don't have a .rb file of the same name as your require statement directly under this path, it won't be detected automatically. I mention this because the common structure is a single file with the library name placed directly in lib, and the actual library contents inside a folder of the same name.

Example: the mime-types library is made up of: lib/mime-types.rb and lib/mime/, which are named differently and can lead to exactly this kind of confusion when including in Ruby.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文