Ruby 'require' error: cannot load such file

后端 未结 13 1517
抹茶落季
抹茶落季 2020-12-02 05:07

I\'ve one file, main.rb with the following content:

require \"tokenizer.rb\"

The tokenizer.rb file is in the same directory and it

13条回答
  •  猫巷女王i
    2020-12-02 05:55

    Ruby 1.9 has removed the current directory from the load path, and so you will need to do a relative require on this file, as David Grayson says:

    require_relative 'tokenizer'
    

    There's no need to suffix it with .rb, as Ruby's smart enough to know that's what you mean anyway.

提交回复
热议问题