Question

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.
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top