Skip to content

Instantly share code, notes, and snippets.

@halostatue
Created March 15, 2016 12:45
Show Gist options
  • Save halostatue/7e8f588088f263d34d74 to your computer and use it in GitHub Desktop.
Save halostatue/7e8f588088f263d34d74 to your computer and use it in GitHub Desktop.
Stopdoc bug in Rdoc

The presence of #:stopdoc: around a class that should be documented is having an outsized impact as shown with this gist, a minimal reproduction of an issue I found during the development of cartage 2.0.

buggy.rb documents Buggy and Buggy::Documented. When buggy-submodule.rb is parsed, Rdoc does not include Buggy in the generated documentation.

This can be worked around by changing buggy-submodule.rb to look like this:

if true
  class Buggy
    # This class won't be documented, but the presence of stopdoc above means
    # that Buggy won't be documented either.
    module Submodule #:nodoc:
    end
  end

  #:stopdoc:
  class Array
    include Buggy::Submodule
  end
  #:startdoc:
end
if true
#:stopdoc:
class Buggy
# This class won't be documented, but the presence of stopdoc above means
# that Buggy won't be documented either.
module Submodule
end
end
#:startdoc:
end
# This class should be documented, but is hidden by the stopdoc in
# Buggy::Submodule.
class Buggy
# This is documented.
module Documented
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment