How can I run a Ruby file with ST2 and see the ouput? I thought I should use the build command. But if I have this:
def foobar
"hello world"
end
puts foobar
and then press cmd + shift + b. All I see is
[Finished in 0.1s]
In textmate I could use the cmd + r (run command) and see all the ouput from the ruby script.
I'm I missing something?
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. From then on, you can run it right there in Sublime by pressing Tools -> Build, or using the CTRL-B hotkey.
Results of Ruby scripts in Sublime Text | by Jason Arnold | Medium. Today I learned that you can run Ruby scripts from inside of Sublime Text. Sure, this isn't going to change the world but now I don't have to leave the editor, go to the terminal, and run the file separately.
I didn't save the file. That's why it didn't work. To run a file without saving it first (like TextMate) you should try to use the Anypreter plugin.
I'm using windows here, but make sure you have selected the correct build system: "Tools > Build System > Ruby", then just press CTRL+B
For future reference, hope it helps somebody:
I came here with the same problem. (In Sublime Text 3) I followed the answers:
and still saw:
[Finished in 0.1s]
In the end the (stuppid) problem was: the console window was only one line big. So I only saw the last line, which is the note:
[Finished in 0.1s]
solution: make the console window bigger et voila. I couldn't find any setting for that. So in the end I did that with the mouse Screenshot Sublime Text 3 - cropped
note the cursor (and ruby extention)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With