Ruby Language IRB Starting an IRB session inside a Ruby script

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


As of Ruby 2.4.0, you can start an interactive IRB session inside any Ruby script using these lines:

require 'irb'

This will start an IBR REPL where you will have the expected value for self and you will be able to access all local variables and instance variables that are in scope. Type Ctrl+D or quit in order to resume your Ruby program.

This can be very useful for debugging.

Got any Ruby Language Question?