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


#1

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.


#2

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


#3

On 15 mar, 14:22, badboy removed_email_address@domain.invalid wrote:

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.


#4

2009/3/15 abc removed_email_address@domain.invalid

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 P.
removed_email_address@domain.invalid
http://thopre.googlepages.com/

Jean Anouilh - “What you get free costs too much.”