[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Saving an IRB Session

Matthew Cox

10/28/2006 12:23:00 PM

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

11 Answers

Robert Klemme

10/28/2006 1:10:00 PM

0

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?

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

Bil Kleb

10/28/2006 1:59:00 PM

0

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

http://www.google.com/search?q=saving+i...

turns up at least two answers:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

Regards,
--
Bil Kleb
http://kleb.tadalist.com/lists/pub...

Robert Klemme

10/28/2006 4:27:00 PM

0

Bil Kleb wrote:
> turns up at least two answers:
>
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

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

robert

James Gray

10/28/2006 7:22:00 PM

0

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
>
> http://www.google.com/search?q=saving+i...
>
> turns up at least two answers:
>
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...

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-hi...
irb

James Edward Gray II

Ben Bleything

10/29/2006 2:05:00 AM

0

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-hi...
> 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
:)

Ben

Paul Duncan

10/31/2006 10:17:00 PM

0

* Ben Bleything (ben@bleything.net) wrote:
> 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-hi...
> > 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
> :)

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

http://pablotron.org/softwa...

Setup:

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

> Ben

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

Ben Bleything

10/31/2006 10:32:00 PM

0

On Wed, Nov 01, 2006, Paul Duncan wrote:
> No one mentioned Wirble, even though it's linked from Ben's post:
>
> http://pablotron.org/softwa...

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

Paul Duncan

11/1/2006 5:40:00 AM

0

* Ben Bleything (ben@bleything.net) wrote:
> On Wed, Nov 01, 2006, Paul Duncan wrote:
> > No one mentioned Wirble, even though it's linked from Ben's post:
> >
> > http://pablotron.org/softwa...
>
> 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. :/

> Ben



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

Paul Duncan

11/1/2006 6:41:00 AM

0

* Ben Bleything (ben@bleything.net) wrote:
> On Wed, Nov 01, 2006, Paul Duncan wrote:
> > No one mentioned Wirble, even though it's linked from Ben's post:
> >
> > http://pablotron.org/softwa...
>
> 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. :(

> Ben



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

James Gray

11/1/2006 2:16:00 PM

0

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:

>> 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