Sublime Forum

How to run Ruby scripts from while in Sublime Text

#1

How to run Ruby code without having to leave Sublime Text and go to the command line?

0 Likes

#2

You can write a build system to accomplish that.

0 Likes

#3

There’s a Ruby build that ships with the default package; you would just need to make sure that in Tools > Build System you set the build to Automatic or Ruby, and then use Tools > Build or the bound key you can see there while you’re editing a Ruby file:

{
	"shell_cmd": "ruby \"$file\"",
	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	"selector": "source.ruby"
}
1 Like

#4

Thank you, it works!

0 Likes