Is there a way to force require
-ing of a file for the second time?
I am writing a library that is located in a path for Ruby. I am editing the file while doing a simple test of it in IRB.
Each time I make a change to the file, I want to reload it without ending the IRB session. Using load
requires typing the whole path to the file each time, and restarting IRB each time requires me to type all the other variable settings required for the simple test.
I just want something like require
but that allows loading for the second time. Is there a simple way to do it?
load
does not require (hmm) a full path. It expects a complete filename with an extension.
p load 'date.rb' #=> true p load 'date.rb' #=> true p load 'date' #=> LoadError
:000> path = "extremely/long/path/to/my/file" :001> load path :002> load path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With