title: Should I define a main method in my ruby scripts?
body: <p>In python, a module doesn't <em>have</em> to have a main function, but it is common practice to use the following idiom:</p>
  
  <pre><code>def my_main_function():
      ... # some code
  
  if __name__=="__main__":  # program's entry point
      my_main_function()
  </code></pre>
  
  <p>I know Ruby doesn't <em>have</em> to have a <code>main</code> method either, but is there some sort of best practice I should follow?  Should I name my method <code>main</code> or something?</p>
  
  <p>The <a href="http://en.wikipedia.org/wiki/Main_function_(programming)#Ruby" rel="noreferrer">Wikipedia page about main methods</a> doesn't really help me.</p>
  
  <hr>
  
  <p>As a side-note, I have also seen the following idiom in python:</p>
  
  <pre><code>def my_main_function(args=[]):
      ... # some code
  
  if __name__=="__main__":  # program's entry point
      import sys
      sys.exit(my_main_function(sys.argv))
  </code></pre>