Search code examples
rubyrdoc

Why does rdoc comments appear to start with two hash/pound symbols?


In the readme for rdoc (https://github.com/ruby/rdoc) the provided examples use two hash/pound symbols on their own line to start the comment block. Is this a requirement or is it just convention? For example (and quoting the readme):

##
# 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

Solution

  • Simple experimentation shows that reducing the double hash to a single hash or even deleting the double-hash line entirely has no impact on rdoc's ability to generate documentation. It's not a requirement, it was a choice made by the author based on personal aesthetics.