Reputation: 219
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?
Upvotes: 1
Views: 1255
Reputation: 124449
Ruby 1.9.2 does not include the current file's directory in $LOAD_PATH
.
You can try using require_relative
instead:
require_relative 'cpu.rb'
Or you can supply the actual path:
require './cpu.rb'
Or you can add the current file's directory to the load path:
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'cpu.rb'
Upvotes: 4