Created
October 1, 2010 19:21
-
-
Save klochner/606704 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
def history(num=100) | |
h = Readline::HISTORY.to_a | |
start = [0,h.size-num-1].max | |
h.zip((0..h.size).to_a)[start...h.size].each do |e,i| | |
puts " #{(i).to_s.rjust(4)} #{e}" | |
end;nil | |
end | |
>> history(7) | |
483 def history(num=100) | |
484 h = Readline::HISTORY.to_a | |
485 start = [0,h.size-num-1].max | |
486 h.zip((0..h.size).to_a)[start...h.size].each do |e,i| | |
487 puts " #{(i).to_s.rjust(4)} #{e}" | |
488 end;nil | |
489 end | |
490 history(7) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash style history command for irb