开发者

Best way to refactor after upgrade to 1.9.2

With the change to 1.9.2, the current directory is no longer in the load path. The announcement suggests against relying on the current directory in your code, but gi开发者_开发百科ves no suggestions for alternatives. What is a "better" way to keep code constrained than separate files linked with require?


If you're talking about the current directory being missing from the search path when using require, try require_relative instead.


require_related was accepted into the core in this conversation. It's part of some security changes because $: no longer includes '.' in the search path.

It was announced as being part of the kernel in the 1.9.2 notes, in the Kernel section.

It's documented as an extension to Kernel but works like the regular require statement only it's relative to the calling script's directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜