Created
September 16, 2008 19:10
-
-
Save ELLIOTTCABLE/11105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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