Skip to content

Printing the Ruby Console History

For better or worse, the Ruby console doesn’t have a shell-like ‘history’ command. Here’s how to simulate it:

Readline::HISTORY.to_a.map {|h| puts h}

Gosh, this stuff is starting to make sense.