Text ruby .rb file

Where do you save the text file that converts to a ruby .rb file to run in the ruby interpreter?

A ruby .rb file is a text file. There’s no special conversion that you need to do. Save your text file as whatever.rb and save it wherever you like. In the same directory, run ruby whatever.rb to have ruby interpret and execute it. If you are writing a larger program or writing a Rails application then there are some conventions to follow as to where to save your files.

There is either a text file or a Ruby script ( not a self-converting file ). Save it wherever you want.

[B]Linux:[/B]   ruby /home/user/programming/application.rb
[B]Windows:[/B] ruby C:\\Development\\application.rb

If you’re on a Unix-like system (anything but Windows), you added the “magic” line to the top of your script (#!/usr/bin/env ruby), and the script is executable (chmod +x yourscript), you can also just run the script directly e.g. ./yourscript

:slight_smile: