Created
September 30, 2011 07:37
-
-
Save ConradIrwin/1252979 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls | |
Tweak display of methods with: | |
-m show only public methods | |
-p show public/protected/private methods (i.e. -p implies -m) | |
-M show only public instance methods | |
-P show public/protected/private instance methods (i.e. -P implies -M) | |
-v show methods from all ancestors (by default show all ancestors up to some ceiling, | |
maybe make ceiling configurable (ActiveRecord::Base), maybe just make it Object) | |
-q don't show methods except those on the singleton class and class (cannot be used with -v) | |
Show other information with: | |
-i instance and class variables (@foo/@@foo) | |
-c show constants defined in the class/module (Foo) | |
-g show global variables ($foo) | |
-l show local variables (foo) | |
Short-hands: | |
-a, short for -pilg (N.B. deliberately excluding -v) | |
-A, short for -Pilgc | |
ls (with no argument), short for ls -pil self | |
ls Module, short for ls -cm | |
ls object, short for ls -m | |
Output formatting: | |
-s, show "short form", i.e. all on one line instead of divided up into sections. | |
Possible extensions: | |
-o for protected/private methods but *not* public ones. Not sure what the use-case is. | |
-O for protected/private instance methods but *not* public ones. | |
--grep // from the current ls, maybe its job is better done by passing an argument to quiet | |
--flood // from the current ls, not sure why given there's a config option..., maybe -s is | |
good enough? | |
--ancestors, also output the ancestors (maybe implied by -v) | |
Allow an argument to -q, which is the ceiling beyond which methods stop | |
ls -m User -q ActiveRecord::Base | |
(be friendly and allow -q Base, and resolve the name in the MRO chain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment