Require command not working within bash irb on Snow Leopard

后端 未结 2 667
北恋
北恋 2021-01-12 08:00

I am working on Zed Shaw\'s Learn Ruby the Hard Way Exercise 25

http://ruby.learncodethehardway.org/ex25.html

When I navigate to the directory that holds the

相关标签:
2条回答
  • 2021-01-12 08:51

    This is because the working directory is no longer in the Ruby path in Ruby 1.9.2. This does work:

    require './ex25'
    
    0 讨论(0)
  • 2021-01-12 08:58

    This is actually a mistake on my part when I was writing the exercise. @mischa is spot on with his solution, but you'll notice as you progress through the book that subsequent exercises use the require_relative command instead of require.

    The various methods for ensuring that your working directory is in the load path are described here, but I suggest you pick one and remain consistent.

    0 讨论(0)
提交回复
热议问题