Underscore
In IRB, the result of the last command is stored in the _
variable, useful when you need to reuse the result.
If that’s not enough, you can activate the history, which will be accessible via the __
variable. ⚠️ This is not an array! It functions as a Hash
whose keys are the IRB execution lines.
There are still a few bugs, but it can be very useful too.
Link to Ruby documentation for IRB history
.