method
create_finalizer
v1_8_6_287 -
Show latest stable
-
0 notes -
Class: IRB::HistorySavingAbility
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
create_finalizer()
public
Hide source
# File lib/irb/ext/save-history.rb, line 53 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