Child sessions of IRB

Source: Internet
Author: User

IRB supports multiple concurrent sessions. You can enter the IRB command in IRB to start a new sub-session. There is only one current session. You can use the jobs command to list all dialogs and use the FG command to switch to another (sleep) session.

Different sub-sessions maintain different variable spaces (variables with the same name have their own values ).

Each sub-session uses its own session prompt. The primary session is indicated by IRB, and other subsessions are represented by IRB #1 and IRB #2. If an object is specified as a parameter during a promoter Session, the object is bound to the self object of the session as the default object of the session. At the same time, the prompt is also reflected.

D: \> irbirb (main): 001: 0> irbirb #1 (main): 001: 0> IRB "another" IRB #2 (another): 001: 0> jobs => #0-> IRB on main (# <thread: 0x34cc748>: Stop) #1-> IRB #1 on main (# <thread: 0x3a49e8c>: stop) #2-> IRB #2 on another (# <thread: 0x3a43a78>: Running) IRB #2 (another): 002: 0> FG 1 = >#< IRB:: IRB: @ signal_status =: in_eval, @ region = # <rubylex: 0x3a49e00>, @ context = # <IRB: Context: 0x3a49e14> IRB #1 (main ): 002: 0> jobs =># 0-> IRB on main (# <thread: 0x34cc748>: Stop) #1-> IRB #1 on main (# <thread: 0x3a49e8c>: Running) #2-> IRB #2 on another (# <thread: 0x3a43a78>: Stop) IRB #1 (main): 003: 0> exit = ># <IRB: @ signal_status =: in_eval, @ region = # <rubylex: 0x3a581bc>, @ context = # <IRB: context: 0x3a58518> IRB (main): 002: 0> jobs => #0-> IRB on main (# <thread: 0x34cc748>: running) #2-> IRB #2 on another (# <thread: 0x3a43a78>: Stop) IRB (main): 003: 0>

Session management Commands include:

    • IRB [object]
      Start a new sub-session and use "object" as the default object to bind (Self)
    • jobs
      display session List
    • CB object
      replace a new object binding
    • FG session ID
      switch to a subsession. The session ID can be a session number, thread ID, IRB object, or bound object.
    • kill session ID
      kill a subsession. The session is marked as above.
    • exit
      exit the current sub-session

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.