Create a gist now

Instantly share code, notes, and snippets.

`self.inspect == 'main'` is no substitute for `__FILE__ == $0`
require './main-tester'
puts "done in caller"
if self.inspect == 'main'
puts "I'm main"
puts "I'm a library"
$ ruby main-tester.rb
I'm main
$ ruby main-tester-caller.rb
I'm main
done in caller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment