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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b00965686932462eb7c765b65c580c4?d=identicon&s=25 Arcadio Rubio garcía (abc)
on 2009-03-15 14:10
(Received via mailing list)
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.
245a6d22816ecaeac1c9080ad183b859?d=identicon&s=25 badboy (Guest)
on 2009-03-15 14:26
(Received via mailing list)
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
Cd6b438f1238ee36cf4daecbae1d3917?d=identicon&s=25 Thomas Preymesser (Guest)
on 2009-03-15 14:36
(Received via mailing list)
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.


see the gem sys-proctable!

-Thomas


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

Jean Anouilh  - "What you get free costs too much."
7b00965686932462eb7c765b65c580c4?d=identicon&s=25 Arcadio Rubio garcía (abc)
on 2009-03-15 14:40
(Received via mailing list)
On 15 mar, 14:22, badboy <bad...@heartofgold.co.cc> 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.
This topic is locked and can not be replied to.