Suppress result output in irb?

T

Tom Pollard

Hi,

Is there a way to prevent irb from printing the result of a
expression to the terminal on a command-by-command basis? I'm trying
to use irb and soap4r to play around with a SOAP server and in many
cases the results are fairly long arrays; I'd like to be able to
prevent these from being displayed automatically. IPython, for
example, will suppress the output from a command if it's terminated
with a semicolon (';'). I was hoping for something similar in irb.

Thanks,

Tom
 
R

rickhg12hs

Tom said:
Is there a way to prevent irb from printing the result of a
expression to the terminal on a command-by-command basis? I'm trying
to use irb and soap4r to play around with a SOAP server and in many
cases the results are fairly long arrays; I'd like to be able to
prevent these from being displayed automatically. IPython, for
example, will suppress the output from a command if it's terminated
with a semicolon (';'). I was hoping for something similar in irb.

For me, with irb 0.9.5(05/04/13) and ruby 1.8.5 (2006-08-25)
[i386-cygwin], a trailing semicolon _does_ suppress printing the result.
 
T

Tom Pollard

Tom Pollard asked:
Is there a way to prevent irb from printing the result of a
expression to the terminal on a command-by-command basis? I'm trying
to use irb and soap4r to play around with a SOAP server and in many
cases the results are fairly long arrays; I'd like to be able to
prevent these from being displayed automatically. IPython, for
example, will suppress the output from a command if it's terminated
with a semicolon (';'). I was hoping for something similar in irb.

rickhg12hs responded:
For me, with irb 0.9.5(05/04/13) and ruby 1.8.5 (2006-08-25)
[i386-cygwin], a trailing semicolon _does_ suppress printing the
result.

Thanks for the quick response.

When I try that (with the same version of irb, but ruby 1.8.4), irb
gives me the "waiting for you to finish the command" prompt.
?>

Are you sure that's not what you're getting, too?

Tom
 
J

Joel VanderWerf

Tom said:
Hi,

Is there a way to prevent irb from printing the result of a expression
to the terminal on a command-by-command basis? I'm trying to use irb
and soap4r to play around with a SOAP server and in many cases the
results are fairly long arrays; I'd like to be able to prevent these
from being displayed automatically. IPython, for example, will suppress
the output from a command if it's terminated with a semicolon (';'). I
was hoping for something similar in irb.

irb(main):002:0> "q"*1000; 0
=> 0
 
T

Tom Pollard

irb(main):002:0> "q"*1000; 0
=> 0

Thanks. (I feel silly for not having thought of that last night.)
It's much better than nothing.

But, is there a good reason why irb itself couldn't suppress the
display of the results when you gave it a command with a trailing
semicolon? I don't see how that would break anything.

Tom
 

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
474,214
Messages
2,571,112
Members
47,704
Latest member
DavidSuita

Latest Threads

Top