title: Ruby OptionParser empty switch "-" behavior
body: <p>EDITED:</p>
  
  <p>I've wrote code that uses OptionParser to handle command line input gracefully. I am facing two major hits.</p>
  
  <ol>
  <li>Passing an empty switches '-' doesn't give an error. Of course some programs take that as valid, but mine shouldn't.</li>
  <li>The program requires two mandatory switches, but it accepts one switch without complaining! e.g. <code>program.ruby -f foo -b bar</code> is the valid input and both switches are :REQUIRED. But providing only one switch passes without problem and this is not the desired behavior.</li>
  </ol>
  
  <p>For the first case I've done this:</p>
  
  <pre><code>opts.on('-', /\A-\Z/) do
    $stderr.print "Invalid empty switch"
    exit 1
  end
  </code></pre>
  
  <p>It works fine. But is this the proper way of doing it?</p>
  
  <p>For the second case, I've looked around for a solution within the OptionParser.new block but I couldn't find one. e.g.</p>
  
  <pre><code>unless options.foo &amp;&amp; options.bar
    puts "Error."
    exit 2
  end
  </code></pre>
  
  <p>Doing it outside the OptionParser.new block is the normal way?</p>