How to require for the second time
listed in answer
ANSWER:
You could write your own and put it in your .irbrc:
New Hotness
module Kernel
# Untested
def reload(lib)
if found = $".find (.rb)?z/ }
load found
else
require found
end
end
end
Minutes-Old and Therefore Busted
module Kernel
# Untested
def reload(lib)
if File.exist?(lib)
load lib
else
lib = "#lib.rb" unless File.extname(lib)=='.rb'
$:.each do |dir|
path = File.join(dir,lib)
return load(path) if File.exist?(path)
end
end
end
end
You’ll have to make it more robust if you want to support RubyGems.

New Comments