【问题标题】:Documenting classes using labeled lists使用标记列表记录类
【发布时间】:2011-06-26 20:29:22
【问题描述】:

我正在使用 Ruby on Rails 3.0.7,并且正在使用 RDoc 为我的应用程序编写一些文档。在我的应用程序文件中,我有这个:

#[EXAMPLE 1 - Some text.]
#
#  [CASE 1 - Some text.]
#  
#    class User < ActiveRecord::Base
#      has_many :account,
#        :class_name  => 'User::Account',
#        :foreign_key => 'account_id'
#    end

在为我的应用程序生成文档时,上面注释的代码会将 class User &lt; ActiveRecord::Baseend 部分留在应该出现的段落块之外。

以下是相关截图:

我该如何解决?

如果我使用它,我会得到相同的输出(在应该出现类语句的段落块之外)

#[Example 1 - Some text.]
#  
#  class User < ActiveRecord::Base
#    has_many :account,
#      :class_name  => 'User::Account',
#      :foreign_key => 'account_id'
#  end

或者这个

#class User < ActiveRecord::Base
#  has_many :account,
#    :class_name  => 'User::Account',
#    :foreign_key => 'account_id'
#end

【问题讨论】:

    标签: ruby-on-rails ruby class documentation rdoc


    【解决方案1】:

    您在 # 和这两行的单词之间只留下了三个空格。它们应该至少有四个空格。将所有代码行每行缩进一个空格,它应该可以工作。

    【讨论】:

    猜你喜欢
    • 2010-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-31
    • 1970-01-01
    • 1970-01-01
    • 2018-07-18
    • 2020-06-18
    相关资源
    最近更新 更多