Via careful use of nroff directives and comments, it’s possible to make a Ruby script that works both as a command line utility you can run, and as a man page. It’s a floor wax and a dessert topping.

This is handy, as it means you can distribute both the utility and the documentation in a single file, and symlink the script into the appropriate man page.

You can also, of course, look for the standard --help command line option, and make your utility call man with its own source file as argument to provide the help.

Note that if your utility makes extensive use of command line options, you’ll probably want to use GetoptLong.