Passing -l
works as the whole line is evaluated as a string by the pry_eval
method. From that it matches the beginning against an existing command and extracts the rest as options to be passed in. From the Pry documentation:
Nearly every piece of functionality in a Pry session is implemented as
a command. Commands are not methods and must start at the beginning of
a line, with no whitespace in between. Commands support a flexible
syntax and allow 'options' in the same way as shell commands
You can see the full list of options by running ls -h
. This will return:
-m, --methods Show public methods defined on the Object (default)
-M, --instance-methods Show 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 locals, including those provided by Pry (in red)
-c, --constants Show constants, highlighting classes (in blue), and exceptions (in purple)
-i, --ivars Show instance variables (in blue) and class variables (in bright blue)
-G, --grep Filter output by regular expression
-h, --help Show this message.