문제

Any idea why certain documentation does not work when using show-doc in pry? E.g. see show-doc with String and Array compared to Set here:

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.
도움이 되었습니까?

해결책

try installing pry-doc gem:

gem install pry-doc

OR

as per @JayKilleen

if you are using pry in your rails environment you can also try installing jazz_hands instead github.com/nixme/jazz_hands which brings pry and other gem functionality into rails console.

다른 팁

String and Array aren't methods, they're classes. That's probably why it's giving you that error there.

String and Array are built-in classes written in C, and you do not have the documentation for them unless you installed them. Set is written in Ruby, and you probably have the documentation as part of the library.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top