Guest User

Untitled

a guest
Jun 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. def history(num=100)
  2. h = Readline::HISTORY.to_a
  3. start = [0,h.size-num-1].max
  4. h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
  5. puts " #{(i).to_s.rjust(4)} #{e}"
  6. end;nil
  7. end
  8.  
  9. >> history(7)
  10. 483 def history(num=100)
  11. 484 h = Readline::HISTORY.to_a
  12. 485 start = [0,h.size-num-1].max
  13. 486 h.zip((0..h.size).to_a)[start...h.size].each do |e,i|
  14. 487 puts " #{(i).to_s.rjust(4)} #{e}"
  15. 488 end;nil
  16. 489 end
  17. 490 history(7)
Add Comment
Please, Sign In to add comment