Is there a way to \"reload\" or \"refresh\" a rubygem in memory? As i\'m playing in irb, occasionally I like to modify my gem files, and if i require the same gem, it does n
One way is to use Kernel#load. You can use it pretty much like Kernel#require, except that you have to explicitly include the file extension. However, it has its drawbacks (even something as simple as class Foo < Struct.new(:foo); end fails, as it is not possible to change the superclass of an class), so I would also like to know a better way to do this.
In rails you can achieve this with reload! on script/console, but I don't know what kind of magic they use.
This gist looks promising but I haven't tested it.