On Sunday, March 30, 2003, 10:31:55 PM, Bil wrote:

> OK, so I admit: I'm stupid.  How do I save the code I've generated
> during an irb session?

Done it.  Put this in your ~/.irbrc

  # Output irb history to named file
  def dumphist(path)
    File.open(path, 'w') do |file|
      Readline::HISTORY.each do |line|
          file.puts line
      end
    end
  end


All you needed to know was that irb uses "Readline" to do command-line
manipulation (including history), then look up Nutshell to see that
Readline::HISTORY is where it's at.  Doesn't sound thread-safe.

Gavin