Skip to content

Instantly share code, notes, and snippets.

@pete
Forked from ab5tract/gist:29216
Created November 26, 2008 02:42
Show Gist options
  • Save pete/29245 to your computer and use it in GitHub Desktop.
Save pete/29245 to your computer and use it in GitHub Desktop.
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