gem install pry. Can be used as a replacement REPL, and also as a debugging tool.
gem install pry
require 'pry' # ... code binding.pry # opens a REPL at this state of the program