Created
January 8, 2010 23:45
-
-
Save AaronH/272588 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # View IRB History of this session | |
| # | |
| # irb_history # return all console commands this session | |
| # irb_history 25 # return last 25 console commands from this session | |
| # irb_history :all # return all console commands from all sessions | |
| # irb_history :all, 25 # return last 25 console commands | |
| # | |
| def hist(*args) | |
| limit = args.last.class == Fixnum ? args.last : MAXHISTSIZE | |
| puts Readline::HISTORY.entries.split("exit"). | |
| send((args.first == :all ? 'flatten' : 'last'))[0..-2]. | |
| last(limit).join "\n" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment