Last Updated: February 25, 2016
·
302
· elgalu

Scripted main in Ruby

Sometimes you have ruby code that is meant to be required by another library or used as a standalone script.. enter "scripted main"

module MyTools
  ... stuff ...
end

if $0 == __FILE__
  # Run itself when the script is directly executed:
  MyTools.start(ARGV)
end

Rack example usage