Ruby RDoc不生成源文件

Ruby RDoc不生成源文件,ruby,rdoc,Ruby,Rdoc,我在Ruby 1.9.2p138中使用RDOC2.58。当我使用Darkfish格式(这是唯一的选项)生成rdoc文件时,我不会使用它获得源代码预览。没有错误消息,正在为所有类生成HTML文件 我已经尝试过更新gem和阅读帮助文件,但是我没有找到任何方法来解决这个问题 这是一个已知的问题吗?我还能试什么 更新: 示例代码: class Iamaclass def initialize @name = "superclass" end def get_na

我在Ruby 1.9.2p138中使用RDOC2.58。当我使用Darkfish格式(这是唯一的选项)生成rdoc文件时,我不会使用它获得源代码预览。没有错误消息,正在为所有类生成HTML文件

我已经尝试过更新gem和阅读帮助文件,但是我没有找到任何方法来解决这个问题

这是一个已知的问题吗?我还能试什么

更新:

示例代码:

class Iamaclass
    def initialize
        @name = "superclass"
    end

    def get_name
        @name
    end

    def proud?
        true
    end
end
Rdoc 2.5.8输出

Parsing sources...
100% [ 1/ 1]  someruby.rb                                                       

Generating Darkfish...

Files:         1
Classes:       1 (    1 undocumented)
Constants:     0 (    0 undocumented)
Modules:       0 (    0 undocumented)
Methods:       3 (    3 undocumented)
  0.00% documented

Elapsed: 0.0s
源代码不会在生成的rdoc中切换

Rdoc 3.5.3输出

100% [ 1/ 1]  someruby.rb                                                       

Generating Darkfish format into /Users/paul/dev/alesrelated/someruby/doc...

Files:      1

Classes:    1 (1 undocumented)
Modules:    0 (0 undocumented)
Constants:  0 (0 undocumented)
Attributes: 0 (0 undocumented)
Methods:    3 (3 undocumented)

Total:      4 (4 undocumented)
  0.00% documented

Elapsed: 0.1s

源代码在html输出中切换。

您需要在代码中添加注释,您可以尝试使用以下示例:

# A description about this class
class Iamaclass
 # A description about this method
 def initialize
    @name = "superclass"
 end

 # Another description about some other method
 def get_name
    @name
 end

 def proud?
    true
 end
end

在此之后,您可以再次尝试运行rdoc命令。

您的源代码是否有文档记录?(有评论等吗?)是的,大部分是这样。但是,即使没有任何注释,当我使用Ruby的早期版本(1.8.7)和不同的格式化程序时,如果我单击一个方法名,我会看到一个带有源代码的弹出窗口。你能提供一个示例吗?生成RDoc时的消息+代码?我实际上通过将RDoc升级到3.5.3解决了这个问题。如果我仍然可以,我会添加一个代码示例。嗯,你可以提供一个答案,这样其他人就会知道该怎么做。2天后您就可以接受它了,但需要注意的是,rdoc不会为您注释内容,它只是将文档美化为可查看的HTML格式。