As others have suggested, you can use Kernel#load. However, don't waste your time finding and loading each gem file as all files that have been required are stored in $". Armed with this knowledge, here's a reload irb command:
def reload(require_regex)
$".grep(/^#{require_regex}/).each {|e| load(e) }
end
For example, if you were using the hirb gem in irb, you would simply reload with:
>> reload 'hirb'
If for whatever reason load doesn't work (it is pickier about file extensions than require is), you can re-require any file by first deleting its entry in $". With this advice the above command would be:
def reload(require_regex)
$".grep(/^#{require_regex}/).each {|e| $".delete(e) && require(e) }
end
Pick whichever works for you. Personally, I use the latter.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…