Skip to content

Instantly share code, notes, and snippets.

@existentialmutt
Last active November 25, 2022 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save existentialmutt/387659d2593cdc71f8d85ffb35392bdc to your computer and use it in GitHub Desktop.
Save existentialmutt/387659d2593cdc71f8d85ffb35392bdc to your computer and use it in GitHub Desktop.
irbr - record irb history to the file of your choice
#!/usr/bin/env ruby
# irbr (short for "IRB Recorder")
#
# Starts an IRB session and appends your history to the specified file
# or "scratch.rb" by default
#
# USAGE irbr.rb output.rb
require "irb"
file = ARGV.first || "scratch.rb"
IRB.conf[:HISTORY_FILE] = file
IRB.conf[:SAVE_HISTORY] = 10_000
IRB.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment