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.
Arcadio R. (Guest)
on 2009-03-15 15: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.
badboy (Guest)
on 2009-03-15 15: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
Thomas P. (Guest)
on 2009-03-15 15:36
(Received via mailing list)
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/
http://thopre.wordpress.com/

Jean Anouilh  - "What you get free costs too much."
Arcadio R. (Guest)
on 2009-03-15 15:40
(Received via mailing list)
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.
This topic is locked and can not be replied to.