How can I know if a program is running inside irb?

A

abc

Hi,

from a certain piece of code, how can I know if it's been run inside
irb, or just ruby. I've tried looking in the IRB rdoc, but haven't
found any relevant methods.

Thanks in advance.
 
B

badboy

abc said:
Hi,

from a certain piece of code, how can I know if it's been run inside
irb, or just ruby. I've tried looking in the IRB rdoc, but haven't
found any relevant methods.

Thanks in advance.
if it is really necessary (I don't know why it should be) maybe it's an
option to use
Object.const_defined? :IRB
 
T

Thomas Preymesser

[Note: parts of this message were removed to make it a legal post.]

2009/3/15 abc said:
Hi,

from a certain piece of code, how can I know if it's been run inside
irb, or just ruby. I've tried looking in the IRB rdoc, but haven't
found any relevant methods.


see the gem sys-proctable!

-Thomas


--
Thomas Preymesser
(e-mail address removed)
http://thopre.googlepages.com/
http://thopre.wordpress.com/

Jean Anouilh - "What you get free costs too much."
 
A

abc

abc schrieb:> Hi,



if it is really necessary  (I don't know why it should be) maybe it's an
option to use
Object.const_defined? :IRB

Thanks. It's just a bit of an ugly hack to know whether I should start
a Curses interface or not. A curses interface misbehaves within irb
since irb is also using curses. That's all.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top