Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
$LOADED_SCRIPTS = {} def absrequire(file) found_candidate = false files = ["#{file.sub(/\.rb$/, '')}.rb", file].uniq $:.each do |load_path| files.each do |f| path = File.expand_path(File.join('.', load_path, f)) if File.exists?(path) if $LOADED_SCRIPTS.has_key?(path) found_candidate = true break end $LOADED_SCRIPTS[path] = file return load(path) end end end return false if found_candidate raise LoadError, "no such file to load -- #{file}" end
From the Design Piracy series on my blog: