Flowdock
extended(obj) public

def HistorySavingAbility.create_finalizer

proc do
if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
  if hf = IRB.conf[:HISTORY_FILE]
    file = File.expand_path(hf)
  end
  file = IRB.rc_file("_history") unless file
  open(file, 'w' ) do |f|
    hist = HISTORY.to_a
    f.puts(hist[-num..-1] || hist)
  end
end
end

end

Show source
Register or log in to add new notes.