Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created September 16, 2008 19:10
Show Gist options
  • Save ELLIOTTCABLE/11105 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/11105 to your computer and use it in GitHub Desktop.
module Kernel
# Runs the passed block of code, if the calling file is the one being executed.
def on_execute
calling_file = caller.first.split(':').first
if File.expand_path(calling_file) == File.expand_path($0)
yield
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment