Skip to content

Commit

Permalink
fix history load speed on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
rf- committed Sep 5, 2011
1 parent 5acbf75 commit 1788285
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/pry/pry_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ def self.view_clip(obj, max_length = 60)

# 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.
Expand Down

0 comments on commit 1788285

Please sign in to comment.