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:
parent
eed9db39e5
commit
0af897ab59
1 changed files with 1 additions and 8 deletions
|
@ -106,14 +106,7 @@ module IRB
|
||||||
end
|
end
|
||||||
|
|
||||||
open(history_file, 'w', 0600 ) do |f|
|
open(history_file, 'w', 0600 ) do |f|
|
||||||
hist = history.map { |l|
|
hist = history.map{ |l| l.split("\n").join("\\\n") }
|
||||||
split_lines = l.split("\n")
|
|
||||||
if split_lines.size == 1
|
|
||||||
l
|
|
||||||
else
|
|
||||||
split_lines.join("\\\n")
|
|
||||||
end
|
|
||||||
}
|
|
||||||
f.puts(hist[-num..-1] || hist)
|
f.puts(hist[-num..-1] || hist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue