reloading required modules in irb

  • Thread starter Heikki Kupiainen
  • Start date
H

Heikki Kupiainen

Hi,

I use irb to evaluate my code while programming.
So it is easy to test my class this way:
require "my_class"
c = MyClass.new
c.some_method

But the problem occurs when I now edit the class adding a new method
"new_method". If I then type:
c.new_method
NoMethodError: undefined method :'new_method'

How can i now re-require "my_class" without restarting irb?
typing again the require command doesn't seem to reload MyClass:
require "my_class"

Nothing happens! The class is not reloaded into memory.

Please tell me somebody how I can refresh the required class!
 
L

Logan Capaldo

Hi,

I use irb to evaluate my code while programming.
So it is easy to test my class this way:


But the problem occurs when I now edit the class adding a new method
"new_method". If I then type:

NoMethodError: undefined method :'new_method'

How can i now re-require "my_class" without restarting irb?
typing again the require command doesn't seem to reload MyClass:


Nothing happens! The class is not reloaded into memory.

Please tell me somebody how I can refresh the required class!

load "myclass.rb"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top