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

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.

abc schrieb:

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

see the gem sys-proctable!

-Thomas

···

2009/3/15 abc <arcadiorubiogarcia@gmail.com>

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.

--
Thomas Preymesser
thopre@gmail.com
http://thopre.googlepages.com/

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

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.

···

On 15 mar, 14:22, badboy <bad...@heartofgold.co.cc> wrote:

abc schrieb:> 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