Ruby require 'file' doesn't work but require './file' does. Why?

前端 未结 3 1224
广开言路
广开言路 2021-02-14 02:25

I have a folder full of ruby files, and when I try and require one file in another that is in the same directory using require \'file\' I get a LoadError

3条回答
  •  自闭症患者
    2021-02-14 03:04

    If you want to require a file not from the system $LOAD_PATH but rather relative to the directory of the file you are requireing from, you should use require_relative. (Which, as you can see, isn't exactly extensively documented.)

提交回复
热议问题