Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Add Comment
Please, Sign In to add comment