3

show-doc知道为什么某些文档在使用in时不起作用pry吗?例如,在这里查看show-doc和比较:StringArraySet

show-doc Set

From: /Users/snowcrash/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/set.rb @ line 3:
Class name: Set
Number of lines: 57

--
set.rb - defines the Set class
++
Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org>

Documentation by Akinori MUSHA and Gavin Sinclair.

All rights reserved.  You can redistribute and/or modify it under the same
terms as Ruby.

  $Id: set.rb 37839 2012-11-24 18:51:45Z knu $

== Overview

This library provides the Set class, which deals with a collection

show-doc String
Error: Cannot locate this method: String.
[7] pry(main)> show-doc Array
Error: Cannot locate this method: Array.
4

3 回答 3

8

尝试安装 pry-doc gem:

gem install pry-doc

或者

根据@JayKilleen

如果您在 Rails 环境中使用 pry,您也可以尝试安装 jazz_hands 而不是 github.com/nixme/jazz_hands,它将 pry 和其他 gem 功能带入 rails 控制台。

于 2013-09-22T06:13:20.160 回答
1

String 和 Array 不是方法,它们是类。这可能就是为什么它在那里给你那个错误。

于 2013-09-22T04:45:13.140 回答
1

String并且Array是用 C 编写的内置类,除非您安装了它们,否则您没有它们的文档。Set是用 Ruby 编写的,您可能将文档作为库的一部分。

于 2013-09-22T05:05:52.470 回答