Ruby FAQ: How do I read command line arguments in a Ruby script (Ruby command line args)?
To read command line args in a Ruby script, use the special Ruby array ARGV to get the information you need. Here are a few examples.
1) Getting the number of command line args
To get the number of command line arguments passed in to your Ruby script, check ARGV.length, like this: