宝石的ruby文档在哪里?

时间:2015-07-28 21:41:05

标签: ruby faraday

在像ipython这样的交互式控制台的python中我可以输入吗?并获得几乎所有库或函数的文档。

我如何在ruby中执行此操作?无论我是使用pry还是irb,我都找不到更多有用的文档。

我试图使用法拉第但键入ri法拉第并没有提供任何文件。键入ri String给出了String的文档,但像法拉第这样的宝石不会产生任何文档。

我做错了什么?

3 个答案:

答案 0 :(得分:1)

查看pry的{​​{3}}扩展程序。

答案 1 :(得分:1)

如果使用gem install --ri faraday安装gem,则会为您生成ri文档。

这应该是默认设置,但由于Ri doc生成可能需要一段时间,很多人会在~/.gemrc中添加一行gem: --no-ri --no-rdoc来禁用它(将这些选项作为gem的默认选项提供命令)。

即使是这种情况,您也可以根据具体情况通过在安装宝石时添加该参数来覆盖它

答案 2 :(得分:1)

If you want to read that doc, You'll are able to run

gem server

That will create a webservice in you host on port 8808, that you will be able to access via browser.

If you want to see where that info is located, run gem env you'll see all paths into GEM PATHS section.

gem env

RubyGems Environment:
.......2.2.2/etc
  - RUBYGEMS PLATFORMS:
    .....
  - GEM PATHS:
     - /home/hbranciforte/.rvm/gems/ruby-2.2.2
     - /home/hbranciforte/.rvm/gems/ruby-2.2.2@global
  - GEM CONFIGURATION:
     .....
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
.....

and if you look at your GEM PATHS you will find a folder called doc.

hbranciforte@hbranciforte-MacBookPro:gems/ruby-2.2.2 $ cd /home/hbranciforte/.rvm/gems/ruby-2.2.2
hbranciforte@hbranciforte-MacBookPro:gems/ruby-2.2.2 $ ls
bin  build_info  cache  doc  environment  extensions  gems  specifications  wrappers

Sometimes (almost I usually do) run your project with bundle --path bundle/vendor

That creates a folder bundle/vendor where it will store your gems and doesn't store doc (that makes bundler much faster than gem install)