diff options
| author | Chad Schroeder <chadrschroeder@users.noreply.github.com> | 2023-09-16 07:48:26 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-09-16 12:48:32 +0000 |
| commit | a8afedce6dfdbab8807134daa926b0936b5cd9a4 (patch) | |
| tree | ad8118fe9e6be7c5aed6b979f917d7e722729c34 /lib | |
| parent | b4213a73b807cf8c8884e29d37308c46ca80352a (diff) | |
[ruby/irb] Handle Concurrent Sessions and Saving Readline::HISTORY
(https://github.com/ruby/irb/pull/651)
* handle concurrent sessions and saving Readline::HISTORY, fixes https://github.com/ruby/irb/pull/510
* separate tests
* don't mutate the HISTORY object on the class
* avoid repeated .to_i calls
* remove intermediary history array
* work with array, fix test comment
---------
https://github.com/ruby/irb/commit/1681ada328
Co-authored-by: Stan Lo <stan001212@gmail.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/irb/history.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/irb/history.rb b/lib/irb/history.rb index ae924d152b..84d69e19cd 100644 --- a/lib/irb/history.rb +++ b/lib/irb/history.rb @@ -10,6 +10,7 @@ module IRB def load_history history = self.class::HISTORY + if history_file = IRB.conf[:HISTORY_FILE] history_file = File.expand_path(history_file) end @@ -32,7 +33,8 @@ module IRB end def save_history - history = self.class::HISTORY + history = self.class::HISTORY.to_a + if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) != 0 if history_file = IRB.conf[:HISTORY_FILE] history_file = File.expand_path(history_file) |
