Saving an IRB Session

Hi,

I'm learning Ruby from the pickaxe book and I'm using the IRB to try
out examples. I'd like to know if it is possible to save to disk the
IRB session so that when I come back I can load up a session to the
state it was in before. Is this possible?

Thanks,
Matt

I do not think so. You certainly can store objects to disk (using Marshal or Yaml) but then you would still be missing a lot info (local variables, files to require etc.)

If you are on a Unix a workaround might be to use screen.

Kind regards

    robert

···

Matthew Cox <Matthew.A.Cox@gmail.com> wrote:

Hi,

I'm learning Ruby from the pickaxe book and I'm using the IRB to try
out examples. I'd like to know if it is possible to save to disk the
IRB session so that when I come back I can load up a session to the
state it was in before. Is this possible?

Matthew Cox wrote:

Hi,

Hi.

I'm learning Ruby from the pickaxe book and I'm using the IRB to try
out examples. I'd like to know if it is possible to save to disk the
IRB session so that when I come back I can load up a session to the
state it was in before. Is this possible?

This comes up from time-to-time. I don't know if
there is a hands-down winner, but

  saving irb session - Google Search

turns up at least two answers:

  http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/68259
  http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/110924

Regards,

···

--
Bil Kleb
http://kleb.tadalist.com/lists/public/427170

Bil Kleb wrote:

turns up at least two answers:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/68259
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/110924

Cool! That looks fairly easy. /me makes mental note.

  robert

Even better, Ben Bleything showed off his IRb enhancements for this in a RubyConf 06 lightening talk. They are quite smooth.

You can get Ben's code from his blog:

http://blog.bleything.net/articles/2006/10/21/shell-style-history-for-irb

James Edward Gray II

···

On Oct 28, 2006, at 9:00 AM, Bil Kleb wrote:

Matthew Cox wrote:

Hi,

Hi.

I'm learning Ruby from the pickaxe book and I'm using the IRB to try
out examples. I'd like to know if it is possible to save to disk the
IRB session so that when I come back I can load up a session to the
state it was in before. Is this possible?

This comes up from time-to-time. I don't know if
there is a hands-down winner, but

saving irb session - Google Search

turns up at least two answers:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/68259
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/11092

Thanks for the mention, James!

I've been meaning to get that cleaned up and post usage examples and
whatnot. In the meantime, if anyone has any questions or suggestions,
I'd be happy to hear 'em.

It also sounds as if Nick Sieger and I are going to be pooling resources
and putting out a gem soon full of similar IRB hacks. Watch this space
:slight_smile:

Ben

···

On Sun, Oct 29, 2006, James Edward Gray II wrote:

Even better, Ben Bleything showed off his IRb enhancements for this
in a RubyConf 06 lightening talk. They are quite smooth.

You can get Ben's code from his blog:

http://blog.bleything.net/articles/2006/10/21/shell-style-history-for-
irb

> Even better, Ben Bleything showed off his IRb enhancements for this
> in a RubyConf 06 lightening talk. They are quite smooth.
>
> You can get Ben's code from his blog:
>
> http://blog.bleything.net/articles/2006/10/21/shell-style-history-for-
> irb

Thanks for the mention, James!

I've been meaning to get that cleaned up and post usage examples and
whatnot. In the meantime, if anyone has any questions or suggestions,
I'd be happy to hear 'em.

It also sounds as if Nick Sieger and I are going to be pooling resources
and putting out a gem soon full of similar IRB hacks. Watch this space
:slight_smile:

No one mentioned Wirble, even though it's linked from Ben's post:

  http://pablotron.org/software/wirble/

Setup:

  $ sudo gem install wirble
  $ cat > ~/.irbrc
  %w{rubygems wirble}.each { |lib| require lib }
  Wirble.init
  $

···

* Ben Bleything (ben@bleything.net) wrote:

On Sun, Oct 29, 2006, James Edward Gray II wrote:

Ben

--
Paul Duncan <pabs@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

In the history realm, does wirble do more than just enabling readline?
I use it for colorization and that, but haven't been able to figure out
much else.

I also emailed you a couple of times to see if you wanted to join forces
with Nick and I, but got no response. It occurs to me now that maybe
they didn't make it through?

Ben

···

On Wed, Nov 01, 2006, Paul Duncan wrote:

No one mentioned Wirble, even though it's linked from Ben's post:

  http://pablotron.org/software/wirble/

> No one mentioned Wirble, even though it's linked from Ben's post:
>
> http://pablotron.org/software/wirble/

In the history realm, does wirble do more than just enabling readline?
I use it for colorization and that, but haven't been able to figure out
much else.

That's pretty much it. I went through the Ruby Garden Irb page and
snagged the useful stuff, then rolled it up with my fancy-schmancy
colorization and called it Wirble.

I also emailed you a couple of times to see if you wanted to join forces
with Nick and I, but got no response. It occurs to me now that maybe
they didn't make it through?

I didn't get them. I've been getting over 20k spam messages per month
for the last two months, so it's possible they may have gotten snagged
by my spam filter.

I'll check my spam folder; it might be time to set up a whitelist and/or
re-train spamprobe. :confused:

···

* Ben Bleything (ben@bleything.net) wrote:

On Wed, Nov 01, 2006, Paul Duncan wrote:

Ben

--
Paul Duncan <pabs@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

> No one mentioned Wirble, even though it's linked from Ben's post:
>
> http://pablotron.org/software/wirble/

In the history realm, does wirble do more than just enabling readline?
I use it for colorization and that, but haven't been able to figure out
much else.

I also emailed you a couple of times to see if you wanted to join forces
with Nick and I, but got no response. It occurs to me now that maybe
they didn't make it through?

I just checked through my spam folder from last month and I didn't see
anything from you. What address did you email (I'm trying to figure out
if I'm losing mail or if the messages got routed to some other folder).

Anyway, I'm interested in collaberating, or, at the very least,
borrowing your guys' hard work and shamelessly rolling it in to Wirble
:).

PS. As of October, I'm officially over 30k spam messages per month --
Yipee. :frowning:

···

* Ben Bleything (ben@bleything.net) wrote:

On Wed, Nov 01, 2006, Paul Duncan wrote:

Ben

--
Paul Duncan <pabs@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562

then rolled it up with my fancy-schmancy
colorization and called it Wirble.

Just FYI, there's a bug in Wirble's colorization I'm hitting pretty often. This exposes it:

>> class Example
>> attr_writer :var
>> end
=> nil
>> ex = Example.new
=> #<Example:0x74722c>
>> ex.var = {:one => 1, :two => 2}
=> {:one=>1, :two=>2}
>> ex
=> #<Example:0x74722c @var={:one=>1, :two=>2}

James Edward Gray II

···

On Oct 31, 2006, at 11:40 PM, Paul Duncan wrote:

>then rolled it up with my fancy-schmancy
>colorization and called it Wirble.

Just FYI, there's a bug in Wirble's colorization I'm hitting pretty
often. This exposes it:

Ergh :/.

>> class Example
>> attr_writer :var
>> end
=> nil
>> ex = Example.new
=> #<Example:0x74722c>
>> ex.var = {:one => 1, :two => 2}
=> {:one=>1, :two=>2}
>> ex
=> #<Example:0x74722c @var={:one=>1, :two=>2}

Well now, that's no good. I'll toss it in my pile o' bugs.

Thanks!

···

* James Edward Gray II (james@grayproductions.net) wrote:

On Oct 31, 2006, at 11:40 PM, Paul Duncan wrote:

James Edward Gray II

--
Paul Duncan <pabs@pablotron.org> pabs in #ruby-lang (OPN IRC)
http://www.pablotron.org/ OpenPGP Key ID: 0x82C29562