title: Use a command line option to call a method
body: <p>So I guess this  is kind of related to my last <a href="https://stackoverflow.com/questions/40478655/ruby-calling-a-method-based-on-an-elseif-statement">question</a>, but I was wondering if there was a way to call a method by using a command line option. Say you had a method like this:</p>
  
  <pre><code>def b
  puts "Hello brian"
  end
  </code></pre>
  
  <p>is there a way to write something like this: </p>
  
  <pre><code>ruby mine.rb -b 
  </code></pre>
  
  <p>and get this</p>
  
  <pre><code>Hello brian
  </code></pre>
  
  <p>I already tried looking for this online and discovered OptionParser but I have yet to discover anything involving the OptionParser calling a method previously created.</p>