-
-
Save pete/29245 to your computer and use it in GitHub Desktop.
This file contains 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
def require(lib) | |
@paths ||= [] | |
return false if @paths.include?(lib) | |
$:.each { |path| | |
['','.rb','.so'].each { |ext| | |
l = "#{path}/#{lib}#{ext}" | |
if File.exist?(l) | |
@paths << l | |
load l | |
return true | |
end | |
} | |
} | |
raise LoadError, "Couldn't load #{lib}!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment