In irb, enter conf.return_format = "" That’ll turn off all
printing of evaluations in irb, which means you have to use puts if
you want to see any results, but it’ll avoid your disasters.
You can add 2 methods to your .irbrc if you like, one that clears the
formatting with the line I gave, and one that sets it back to normal
(the default is “=> %s\n”), so that you can switch back and forth
between the two modes easily.
There may be a better solution, but this is all I came up with.
Still, I hope it helps.
There may be a better solution, but this is all I came up with.
There is another solution, that of course I realize after I send out
the message. You can set conf.return_format to “=> %0.100s\n”, where
the number after the . (in this case 100), is the maximum number of
characters you want printed to the screen.
I’m trying to keep a thread alive after exiting a method. The pseudo-
code is as follows:
class A
def start
@mainThread = Thread.new {
oneThread = Thread.new {
# do some stuff
}
twoThread = Thread.new {
# do some other stuff
}
oneThread.join
twoThread.join
}
end
end
aObject = A.new
aObject.start
The problem is that since there is no :join call on @mainThread, it
is killed (and hence oneThread, and twoThread as well) once control
ends in :start. This is perfectly valid, of course, but I would like @mainThread to stay alive after control in :start ends. Is there any
way to do this? Thanks
Thanks for your help. Tim’s suggestions are nice, but I’d prefer to be
able to make the print/no-print decision on the fly, on a per-statement
basis. On these grounds, Caleb’s suggestion meets my needs best. I
had actually tried using a semicolon, but of course irb then just waits
for the next statement. Putting a 0 (or anything else) is a bit of a
kludge compared to the Python interpreter’s convention, but it gets the
job done.