Why doesn't relative_require work on Ruby 1.8.6?

后端 未结 2 770
猫巷女王i
猫巷女王i 2020-12-16 13:29

I\'m learning Ruby (using version 1.8.6) on Windows 7.

When I try to run the stock_stats.rb program below, I get the following error:



        
2条回答
  •  星月不相逢
    2020-12-16 13:57

    require_relative doesn't exist in your version of Ruby. You could upgrade Ruby, install the backports gem and require 'backports/1.9.1/kernel/require/relative' but the easiest fix will be to change your require to:

    require File.join(File.dirname(__FILE__), 'csv_reader')
    

提交回复
热议问题