Irb history with Ruby 1.8.6

gmarik 1 min

Somehow got irb history broken.

Googling brought a solution

Here’s the simplified version of the fix I’ve came with:

module IRB
  def HistorySavingAbility.extended(obj); 
    Kernel.at_exit{ HistorySavingAbility.create_finalizer.call }
    obj.load_history
    obj
  end
end 

Put it into .irbrc

Turns out that finalizer is not guaranteed to run, so Kernetl.at_exit hook should be used instead, to persist history

Read More
Building Ruby 1.8.6 with Openssl 1 on Arch
Building Rmagick gem and how to avoid memory leak
Comments
read or add one↓