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

Discussion in 'Ruby' started by abc, Mar 15, 2009.

  1. abc

    abc Guest

    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, Mar 15, 2009
    #1
    1. Advertising

  2. abc

    badboy Guest

    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
    badboy, Mar 15, 2009
    #2
    1. Advertising

  3. [Note: parts of this message were removed to make it a legal post.]

    2009/3/15 abc <>

    > 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

    http://thopre.googlepages.com/
    http://thopre.wordpress.com/

    Jean Anouilh - "What you get free costs too much."
    Thomas Preymesser, Mar 15, 2009
    #3
  4. abc

    abc Guest

    On 15 mar, 14:22, badboy <> 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


    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.
    abc, Mar 15, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexander Mahone

    Running a program (gperf) inside another C program

    Alexander Mahone, May 26, 2008, in forum: C Programming
    Replies:
    4
    Views:
    406
    Flash Gordon
    May 26, 2008
  2. Sam Stephenson
    Replies:
    1
    Views:
    225
    Andrew Walrond
    Jun 18, 2005
  3. Replies:
    1
    Views:
    159
    Florian Groß
    Oct 26, 2005
  4. Pete Elmore
    Replies:
    1
    Views:
    105
    Pete Elmore
    Oct 21, 2007
  5. Andries

    I know, I know, I don't know

    Andries, Apr 23, 2004, in forum: Perl Misc
    Replies:
    3
    Views:
    229
    Gregory Toomey
    Apr 23, 2004
Loading...

Share This Page