The ls command is one of my favorites when using Pry. It gives users a quick overview on the objects with information like:
- Methods & their defined classes
- Constants
- Instance variables
- Locals

Usage
[4] pry(main)> ls -h
Usage: ls [-m|-M|-p|-pM] [-q|-v] [-c|-i] [Object]
ls [-g] [-l]
ls shows you which methods, constants and variables are accessible to Pry. By
default it shows you the local variables defined in the current shell, and any
public methods or instance variables defined on the current object.
# .....
Also check out `find-method` command (run `help find-method`).
-m, --methods Show public methods defined on the Object
-M, --instance-methods Show public methods defined in a Module or Class
-p, --ppp Show public, protected (in yellow) and private (in green) methods
-q, --quiet Show only methods defined on object.singleton_class and object.class
-v, --verbose Show methods and constants on all super-classes (ignores Pry.config.ls.ceiling)
-g, --globals Show global variables, including those builtin to Ruby (in cyan)
-l, --locals Show hash of local vars, sorted by descending size
-c, --constants Show constants, highlighting classes (in blue), and exceptions (in purple).
Constants that are pending autoload? are also shown (in yellow)
-i, --ivars Show instance variables (in blue) and class variables (in bright blue)
-G, --grep Filter output by regular expression
-d, --dconstants Show deprecated constants
-h, --help Show this message.
Implementation Options
Add a new command
If we go for this, we should come up with a new name though. Because this project already has the l[ist] command for listing source code, naming this command ls could be confusing.
Enhance the info command
The info command is designed to show information about the current frame. So it doesn't exactly match what Pry's ls does. But if we can add the current functionality to a info f[rame] subcommand, info can be more generic and perform something like the ls does.
The
lscommand is one of my favorites when usingPry. It gives users a quick overview on the objects with information like:Usage
Implementation Options
Add a new command
If we go for this, we should come up with a new name though. Because this project already has the
l[ist]command for listing source code, naming this commandlscould be confusing.Enhance the
infocommandThe
infocommand is designed to show information about the current frame. So it doesn't exactly match whatPry'slsdoes. But if we can add the current functionality to ainfo f[rame]subcommand,infocan be more generic and perform something like thelsdoes.