Ruby equivalent of python -i
When you run python -i <filename>
, the interpreter runs through the program and leaves you with a console for further exploration.
For a long time, I was strugging to find the same functionality in Ruby. Turns out that it is impossible with just irb
, though pry
does seem to offer it.
Install pry:
gem install pry
Structure your code like this:
require 'pry' # do the things binding.pry
This is still not as convenient as the Python equivalent….