RubyInstallerをWindowsにインストールしましたが、IMAP Syncを実行していますが、何百ものアカウントを同期するために使用する必要があります。これらの変数をコマンドラインで渡すことができれば、プロセス全体をより自動化することができます。Rubyスクリプトにコマンドラインで変数を渡す
# Source server connection info.
SOURCE_NAME = '[email protected]'
SOURCE_HOST = 'mail.example.com'
SOURCE_PORT = 143
SOURCE_SSL = false
SOURCE_USER = 'username'
SOURCE_PASS = 'password'
# Destination server connection info.
DEST_NAME = '[email protected]'
DEST_HOST = 'imap.gmail.com'
DEST_PORT = 993
DEST_SSL = true
DEST_USER = '[email protected]'
DEST_PASS = 'password'
私は明示的にいくつかの他の言語がそうであるようにARGV [0]、プログラム名を指していないことを指摘したいと思います。プログラム名を取得するには、http://stackoverflow.com/questions/4834821/how-can-i-get-the-name-of-the-command-called-for-usage-prompts-in-ruby –