Documenting constants and methods

孤街醉人 提交于 2019-12-13 03:54:50

问题


I am writing a documentation for my Ruby on Rails 3.0.7 application using RDoc. In the application lib folder, I have the following:

module ModuleName
  class ModuleName::User < ActiveRecord::Base
    #'CONSTANT' documentation text
    CONSTANT = 'Test constant'

    #'method_name' documentation text
    def method_name
      ...
    end
  end
end

When I try to generate the documentation for the code above, RDoc will not parse the #'CONSTANT' documentation text and the #'method_name' documentation text, so the ouput documentation is blank.

1. How can I make RDoc to consider the commented code in the module "context"?

It doesn't help if I use the :doc: directive as follows:

module ModuleName #:doc:
  class ModuleName::User < ActiveRecord::Base #:doc:
    #'CONSTANT' documentation text
    CONSTANT = 'Test constant' #:doc:

    #'method_name' documentation text
    def method_name #:doc:
      ...
    end
  end
end

I note that I have these in the Class\Module Index:

ModuleName
ModuleName::ModuleName
ModuleName::ModuleName::ModuleName
ModuleName::ModuleName::ModuleName::User

2. What do they mean?

来源:https://stackoverflow.com/questions/6486923/documenting-constants-and-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!