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.
문제
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?
해결책
다른 팁
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.
제휴하지 않습니다 StackOverflow