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

fix history load speed on startup

This commit is contained in:
Ryan Fitzgerald 2011-09-04 18:14:37 -07:00
parent 5acbf751c0
commit 1788285ccb

View file

@ -123,8 +123,13 @@ class Pry
# Load Readline history if required.
def self.load_history
Readline::HISTORY.push(*File.readlines(history_file).map(&:chomp)) if File.exists?(history_file)
@loaded_history = Readline::HISTORY.to_a
@loaded_history = []
if File.exists?(history_file)
File.foreach(history_file) do |line|
Readline::HISTORY << line.chomp
@loaded_history << line.chomp
end
end
end
# Save new lines of Readline history if required.