1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Simplify history saving code

This commit is contained in:
aycabta 2019-07-15 10:20:07 +09:00
parent eed9db39e5
commit 0af897ab59

View file

@ -106,14 +106,7 @@ module IRB
end
open(history_file, 'w', 0600 ) do |f|
hist = history.map { |l|
split_lines = l.split("\n")
if split_lines.size == 1
l
else
split_lines.join("\\\n")
end
}
hist = history.map{ |l| l.split("\n").join("\\\n") }
f.puts(hist[-num..-1] || hist)
end
end