简体   繁体   English

Ruby 2.2.2 ri文档

[英]Ruby 2.2.2 ri documentation

I'm starting to learn Ruby, so I installed Ruby 2.2.2 via Macports. 我开始学习Ruby,所以我通过Macports安装了Ruby 2.2.2。 I understand that the ri documentation does not install by default, so I want to generate it. 我知道ri文档默认不安装,所以我想生成它。 I read a few questions/answers on SO and came up with this: 我在SO上阅读了几个问题/答案并想出了这个:

gem install rdoc-data

rdoc-data --install

and was told: Your ruby version 2.2.2 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0 并被告知: Your ruby version 2.2.2 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0

How do I get the ri documentation for 2.2.2? 我如何获得2.2.2的ri文档? Is there another method? 还有另一种方法吗?

If you are using version 2.0 or the latest, and you use Ruby Installer for Windows then do the following: 如果您使用的是2.0版或更新版,并且使用Ruby Installer for Windows,请执行以下操作:

In the command prompt and while you are in the Ruby installation folder, it is sufficient to type gem install rdoc-data in the command prompt. 在命令提示符下,当您在Ruby安装文件夹中时,在命令提示符下键入gem install rdoc-data就足够了。 This results into generating rdocs in the folder named doc in the Ruby installation folder. 这导致在Ruby安装文件夹中名为doc的文件夹中生成rdocs。

Instead of browsing online to check for API or documentations, you can just conveniently open the files in the doc folder. 您可以方便地打开doc文件夹中的文件,而无需在线浏览以检查API或文档。 I know it is kind of against the teaching of most books and tutorials for Ruby, but keep it in mind that you just generated an API in your hard-drive and you do not have to use ri in the command prompt. 我知道这有点违背Ruby的大多数书籍和教程的教学,但请记住,您刚刚在硬盘驱动器中生成了一个API,并且您不必在命令提示符中使用ri You can just have the API open the entire time while coding. 您可以在编码时让API一直打开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM