code_junkie

Run a Ruby library from the command-line

Nov 13th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. if __name__ == '__main__':
  2. # do something here
  3.  
  4. if from_command_line?
  5. # do something here
  6. end
  7.  
  8. if __FILE__ == $0
  9. # do stuff
  10. end
  11.  
  12. if __FILE__ == $0
  13. Foo.run
  14. end
  15.  
  16. if File.identical?(__FILE__, $0)
  17. Foo.run
  18. end
Add Comment
Please, Sign In to add comment