Last active
October 8, 2017 09:51
-
-
Save chsh/3c59ef2f236c82e45ecf0b7c51dcea09 to your computer and use it in GitHub Desktop.
irbでソースコードフォルダ毎に履歴を分けて保存する ref: http://qiita.com/chshii/items/ba10dcc8dcc24b315d16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'irb/ext/save-history' | |
IRB.conf[:SAVE_HISTORY] = 80000 # このあたりはお好みで。 | |
require 'digest/md5' | |
require 'fileutils' | |
history_base = File.join(ENV['HOME'], '.irb', 'histories') | |
FileUtils.mkdir_p history_base unless Dir.exist? history_base | |
pwd_hash = Digest::MD5.hexdigest(`pwd`.chomp) | |
IRB.conf[:HISTORY_FILE] = File.join(history_base, pwd_hash) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment