From 0af897ab59dfa3d06724f898f17bbf8a1970abd1 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 15 Jul 2019 10:20:07 +0900 Subject: [PATCH] Simplify history saving code --- lib/irb/ext/save-history.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb index dfde9d6fae..57ba7c1c53 100644 --- a/lib/irb/ext/save-history.rb +++ b/lib/irb/ext/save-history.rb @@ -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