Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run ruby on terminal using sublime

I'm not even sure if this question is right.

I'm doing a ruby tutorial on the following link www.youtube.com/watch?v=Dji9ALCgfpM

And he writes code on sublime, and the ran code is shown on terminal. I used to do berry thing on integrative ruby, irb. What's the difference?

like image 262
user2998413 Avatar asked Feb 09 '23 16:02

user2998413


1 Answers

You have two main options:

The first option is to run the Ruby code in your terminal. Save your Ruby file as somename.rb. In your terminal, navigate to the directory you saved it in, and then simply run it with

ruby somename.rb

It should then run nicely. Do make sure you have Ruby installed on your system first, otherwise look here

Alternatively you can run it right there in Sublime Text. Make sure you're in Ruby mode by clicking on the language selector in the bottom-right corner of the screen.

Also - in the top menu go to Tools -> Build System -> Ruby

From then on, you can run it right there in Sublime by pressing Tools -> Build, or using the CTRL-B hotkey.

like image 157
Azarantara Avatar answered Feb 15 '23 17:02

Azarantara