rubymine注释掉rails代码

时间:2011-04-18 11:42:43

标签: ruby-on-rails rubymine

在rubymine中很容易用代码编写html代码 - >行注释,但你如何评论ruby中的多行。

%= "this is a test %>

#= "this is a test %>

3 个答案:

答案 0 :(得分:8)

选择要注释掉的行,并在Mac上执行CMD+/(正斜杠)。在PC上,我假设同样的事情是CTRL+/

您可以以相同的方式取消评论,也可以使用相同的按键注释单行。光标在线上的位置并不重要。只要选择了部分行,评论就会包含整行。

答案 1 :(得分:3)

Ruby确实有多行注释,尽管它们使用了一种相对奇怪的语法:

=begin
some text or code here
=end

请注意,=begin=end分隔符必须位于该行的最开头,其他任何内容都不应位于同一行。

答案 2 :(得分:0)

评论一些像这样的想法

=begin
  your code is commented out
  this line is also commented
=end

选择行并按ctrl + shift + / 评论一些像这样的想法

#your code is commented out
#this line is also commented

选择行并按ctrl + /

相关问题