Question

I'm working in an IRB shell on a dos CMD

I load a module from a mystuff file require '.\mystuff'

I change the module in the mystuff file and I type again require '.\mystuff'

How come the IRB does not pick up the changes in the file when I try to call functions or variables from the newest version of my mystuff module?

Was it helpful?

Solution

require will not load the same file twice. If you want to load the file again, you need to use load. See What is the difference between include and require in Ruby? for more information.

OTHER TIPS

Your Syntax is Wrong

Ruby doesn't use backslashes. You need to use forward slashes, or use File#join.

Your $LOAD_PATH is Wrong

Your $LOAD_PATH (a.k.a $:) is wrong. You need to include the present working directory with:

$: << '.'

in irb, or use Kernel#require_relative in executable or sourced files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top