How to open .rb files

Hi,

Can someone help me with opening a .rb file? I downloaded the ruby
installer and then I downloaded the Scite program. When I saved the
Scite file as a .rb file, i couldn’t open it on the “Start Command
Prompt with Ruby”. my code was:

irb
require “first.rb”

My file was called first.rb but it came up with “cannot load such file
– first.rb”

Can someone help me? I’m a newbie at this

Thanks,

Bon

Trying providing the full path to the file, or make sure that the
present working directory is in the same place as the .rb file.

If you drag the file into the console window it will usually write the
full path of the file for you.

You can use “Dir.pwd” to show your working directory, and
“Dir.chdir(‘path/to/directory’)” to change the working directory.

Also you can try this way from irb:

require ‘./first’ or require_relative ‘first’

Extension is not necessary.

Awesome, It works!

Thanks Guys!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs