During development I found myself checking the some results in the Ruby console everyday. This is done by typing the same commands with different parameters every time. However these command can be long, or sometimes several commands need to run sequentially.
For example:
Nokogiri.HTML(open(Rails.root.join('page/p1.html')))
I am wondering if it is possible to specify some convenience functions, which automatically gets loaded when I run the console? So I can call complex calls anytime I want in the console.
I also heard that there are console replacements. So it doesn’t have to be the native console, as long as it offers similar functionalities.
As d11wtq pointed out, according to the console you use, you can use the its configuration file to write your own convenience functions:
IRB has ~/.irbrc
PRY has ~/.pryrc
RIB has ~/.rib/config.rb
Place the code in these and you can call them in the console.