26
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

irbの履歴を保存する

Posted at

irbはちょっと試してみる分には便利なんですが、
いつも何を入力したか忘れてしまうので、
まとめてスクリプトに保存しようとするとちょっと面倒です。

そこで、~/.irbrcに以下のように書くと、
~/.irb_historyに履歴が残るようになります。

そこから必要なところを抜き出してあげることで、
簡単にスクリプトを作ることができます。

require 'irb/completion'
require 'irb/ext/save-history'

IRB.conf[:SAVE_HISTORY] = 10000
IRB.conf[:HISTORY_FILE] = File.expand_path('~/.irb_history') 
26
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?