I’m trying to call the file from the file cpu.rb from main.rb:
require 'rubygems'
require 'cpu.rb'
But it does not work. I use Netbeans and Ruby 1.9.2. What’s the problem?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ruby 1.9.2 does not include the current file’s directory in
$LOAD_PATH.You can try using
require_relativeinstead:Or you can supply the actual path:
Or you can add the current file’s directory to the load path: