Ruby Interactive Shell

J

Jenjhiz

Hello,
I'm looking for a Ruby interactive shell where I can paste snippet of
codes (rather than typing them in). eval.rb doesn't do it (or I haven't
found a way to make it do it).
Thanks!
gk
 
C

Charles Mills

Jenjhiz said:
Hello,
I'm looking for a Ruby interactive shell where I can paste snippet of
codes (rather than typing them in). eval.rb doesn't do it (or I haven't
found a way to make it do it).
Thanks!
gk

There is an answer to your question at the bottom of this page:
http://rubygarden.org/ruby?Irb/TipsAndTricks

<snip>
If you add this to your .irbrc file:
IRB.conf[:pROMPT][:XMP][:RETURN] = "\# => %s\n"

and start with irb --prompt xmp you'll have a great session for copying
and pasting code.
</snip>

-Charlie
 
R

Robert Klemme

Jenjhiz said:
Hello,
I'm looking for a Ruby interactive shell where I can paste snippet of
codes (rather than typing them in). eval.rb doesn't do it (or I haven't
found a way to make it do it).
Thanks!
gk

IRB comes with your Ruby installation.

Kind regards

robert
 
K

Kent Sibilev

If you are emacs user, ruby-mode provides that (C-c C-r
ruby-send-region).

Cheers,
Kent.
 
M

Martin DeMello

Tom Rathbone said:

My fault, I'm afraid - I've had zero time to work on this lately :( I'll
try to have the basic keybindings finished by the end of the week and
put out a 0.01 release. The CVS version already has indenting and some
level of dedenting working, which is the other half of what I wanted
before I released it. Forthcoming features (short term):

1. A few decent key bindings
2. Multiline edit
3. Integration with ihelp

Feature requests happily accepted. I'm also pondering an IRC-style input box
and output pane - any thoughts?

martin
 
C

Caio Tiago Oliveira

Charles Mills, 6/2/2005 15:35:
irb --prompt xmp you'll have a great session for copying
and pasting code.


But you can't paste code that contains '?' because IRB wil think it
shoulds autocomplete.
Also irb crashes a lot.
 
J

Jeremy Henty

Also irb crashes a lot.

Say what? I've been an enthusiastic Ruby/Irb user for around 2 years
now and I've *never* seen irb crash. What platform are you running
on?

Jeremy Henty
 
C

Caio Tiago Oliveira

Jeremy Henty, 6/2/2005 21:05:
Say what? I've been an enthusiastic Ruby/Irb user for around 2 years
now and I've *never* seen irb crash. What platform are you running
on?

I'm in a PC platform, WinXP as Operating System.
Irb crashes mainly when I use the autocompletion (the bigger the number
of possibilities the worse)or when I'm overriding a method.

It says... (let me crash it now):
"irb(main):003:0* c:/ruby/lib/ruby/1.8/irb/workspace.rb:52: [BUG]
Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-mswin32]


This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information."

I don't know wether it has been reported already, but always that I type
a variable name, press Enter and then Tab it crashes.
<<press tab>>

crash!

But it also crash a lot in day by day work.
 
J

jenjhiz

Thanks for the lead. However, I can't find an .irbrc file anywhere in
my machine (Windows XP). Where is it located?

Thanks,
gk


Charles said:
Jenjhiz said:
Hello,
I'm looking for a Ruby interactive shell where I can paste snippet of
codes (rather than typing them in). eval.rb doesn't do it (or I haven't
found a way to make it do it).
Thanks!
gk

There is an answer to your question at the bottom of this page:
http://rubygarden.org/ruby?Irb/TipsAndTricks

<snip>
If you add this to your .irbrc file:
IRB.conf[:pROMPT][:XMP][:RETURN] = "\# => %s\n"

and start with irb --prompt xmp you'll have a great session for copying
and pasting code.
</snip>

-Charlie
 
J

jenjhiz

If nothing else works, or works well, I may have to -- sigh -- look at
emacs.

Thanks,
gk
 
C

Charles Mills

jenjhiz said:
Thanks for the lead. However, I can't find an .irbrc file anywhere in
my machine (Windows XP). Where is it located?

I use cygwin when on windows. With cygwin your "C:\Documents and
Settings\user_name" directory is your home directory. So you put it in
there.

Your probably using the one-click installer if irb is crashing on you
:) - I had that experiance too - I am not sure what the answer is under
that setup.

-Charlie
snippet
of
codes (rather than typing them in). eval.rb doesn't do it (or I haven't
found a way to make it do it).
Thanks!
gk

There is an answer to your question at the bottom of this page:
http://rubygarden.org/ruby?Irb/TipsAndTricks

<snip>
If you add this to your .irbrc file:
IRB.conf[:pROMPT][:XMP][:RETURN] = "\# => %s\n"

and start with irb --prompt xmp you'll have a great session for copying
and pasting code.
</snip>

-Charlie
 
T

Tom Rathbone

I have this problem too.. it is very annoying. I work with Linux
during the day but when I get home I only get to use WinXP. Not
having irb handy removes a certain amount of the joy from Ruby. I was
told that installing new readline .dll and .so files could help this
but it doesn't seem to make a difference.

I had hoped that FXirb would address this but it doesn't seem to
support autocompletion yet.

Anybody know a way of getting the one-click irb to behave?

Jeremy Henty, 6/2/2005 21:05:
Say what? I've been an enthusiastic Ruby/Irb user for around 2 years
now and I've *never* seen irb crash. What platform are you running
on?

I'm in a PC platform, WinXP as Operating System.
Irb crashes mainly when I use the autocompletion (the bigger the number
of possibilities the worse)or when I'm overriding a method.

It says... (let me crash it now):
"irb(main):003:0* c:/ruby/lib/ruby/1.8/irb/workspace.rb:52: [BUG]
Segmentation fault
ruby 1.8.2 (2004-12-25) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information."

I don't know wether it has been reported already, but always that I type
a variable name, press Enter and then Tab it crashes.
<<press tab>>

crash!

But it also crash a lot in day by day work.
 
C

Curt Hibbs

Charles said:
I use cygwin when on windows. With cygwin your "C:\Documents and
Settings\user_name" directory is your home directory. So you put it in
there.

Your probably using the one-click installer if irb is crashing on you
:) - I had that experiance too - I am not sure what the answer is under
that setup.

Its the same under the one-cick installer.

Curt
 
G

gabriele renzi

Tom Rathbone ha scritto:
I have this problem too.. it is very annoying. I work with Linux
during the day but when I get home I only get to use WinXP. Not
having irb handy removes a certain amount of the joy from Ruby. I was
told that installing new readline .dll and .so files could help this
but it doesn't seem to make a difference.

I had hoped that FXirb would address this but it doesn't seem to
support autocompletion yet.

Anybody know a way of getting the one-click irb to behave?

it is a known problem, if you look at the archives.
Sadly it seem noone has a clue on how to fix it :)
Even if, IIRC, someone hinted it could relate to something like
readline/cmd.exe's output buffer being overflowed, and in fact, if you
try autocompleting a constant it seem to run fine (provided you did not
set too much constants :), while it crashes if you try to expand
something like "Object.<tab>".

PS
please consider avoiding top-posting, it is a bad habit :)
 
C

Curt Hibbs

gabriele said:
Tom Rathbone ha scritto:

it is a known problem, if you look at the archives.
Sadly it seem noone has a clue on how to fix it :)
Even if, IIRC, someone hinted it could relate to something like
readline/cmd.exe's output buffer being overflowed, and in fact, if you
try autocompleting a constant it seem to run fine (provided you did not
set too much constants :), while it crashes if you try to expand
something like "Object.<tab>".

If anyone has a solution, I would implemented in the one-click installer in
a heartbeat!

Curt
 
T

Tom Rathbone

PS
please consider avoiding top-posting, it is a bad habit :)

Agreed.. sorry, gmail doesn't seem to have a preference and this one
slipped through.


On a different note, anyone familiar with FOX and/or IRB care to
comment on the following?

I've just taken a look at the source for WinIrb and was wondering how
hard it would be to add an optional sidebar with a list of all
declared local_variables and perhaps their values if they are trivial
objects. I think this would be very useful for those shell sessions
where you are making it up as you go along. Would this be difficult?

Secondly, I wanted ot see if I could add tab completion, hooking the
tab key up seems easy but what method should be called to get irb to
return a list of possible solutions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,217
Latest member
topweb3twitterchannels

Latest Threads

Top