문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top