If you are going to distribute the Ruby script to others as a standalone program, then using
./ would be preferred as the user won’t have to know how and which program to use to run the script.
irb is actually a Ruby script and you can run it with calling
irb instead of
ruby irb. Also, a big advantage over this, you could make sure the script to only use a specific program to run the script or it’ll fail to run (which is good compared to the program running fine early on but breaks down a few minutes later due to incompatible ruby version in some part of your code)
For example, whether the script want to call
bash etc…, is depending on the shebang line string in the script.
Another thing is, if you put the executable script into a directory which is known by
$PATH environment variable, you can invoke it from anywhere in your system using
my_ruby_script_or_similar instead of
/path/to/my_ruby_script_or_similar every time which can be tedious and hard to remember the path.