在 sublime text 2 中执行 Ruby 代码 [英] Execute Ruby code in sublime text 2

查看:55
本文介绍了在 sublime text 2 中执行 Ruby 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 ST2 运行 Ruby 文件并查看输出?我想我应该使用 build 命令.但如果我有这个:

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

然后按 cmd + shift + b.我看到的都是

and then press cmd + shift + b. All I see is

[Finished in 0.1s]

在 textmate 中,我可以使用 cmd + r(运行命令)并查看 ruby​​ 脚本的所有输出.

In textmate I could use the cmd + r (run command) and see all the ouput from the ruby script.

我错过了什么吗?

推荐答案

我没有保存文件.这就是它不起作用的原因.要在不先保存文件的情况下运行文件(如 TextMate),您应该尝试使用 Anypreter 插件.

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.

这篇关于在 sublime text 2 中执行 Ruby 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆