ruby 为什么rdoc注解以两个hash/磅符号开头?

zzzyeukh  于 12个月前  发布在  Ruby
关注(0)|答案(1)|浏览(100)

在rdoc(https://github.com/ruby/rdoc)的自述文件中,所提供的示例在它们自己的行上使用两个哈希/磅符号来开始注解块。这是一个要求还是只是惯例?例如(并引用自述):

##
# This class represents an arbitrary shape by a series of points.

class Shape

  ##
  # Creates a new shape described by a +polyline+.
  #
  # If the +polyline+ does not end at the same point it started at the
  # first pointed is copied and placed at the end of the line.
  #
  # An ArgumentError is raised if the line crosses itself, but shapes may
  # be concave.

  def initialize polyline
    # ...
  end

end
i2loujxw

i2loujxw1#

简单的实验表明,将双散列减少为单散列,甚至完全删除双散列行,都不会影响rdoc生成文档的能力。这不是要求,而是作者基于个人审美的选择。

相关问题