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

On 15 mar, 14:22, badboy [email protected] 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.

2009/3/15 abc [email protected]

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.
[email protected]
http://thopre.googlepages.com/

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs