Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ruby-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ jobs:
- name: Generate Documentation with RDoc
run: make html
working-directory: ruby/ruby
- name: Core docs coverage
# Exclusions match RDOC_COVERAGE_EXCLUDES in ruby/ruby's common.mk.
# Run after make html so the build environment is fully set up
# (rbconfig.rb, generated files, etc.), matching ruby/ruby's CI.
run: >
make XRUBY=ruby RDOC_DEPENDS= RBCONFIG=update-rbconfig
rdoc-coverage
working-directory: ruby/ruby
# We need to clear the generated documentation to generate them again
# with the Ripper parser.
- name: Clear Generated Documentation
Expand Down
4 changes: 3 additions & 1 deletion lib/rdoc/code_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def initialize_visibility # :nodoc:
@received_nodoc = false
@ignored = false
@suppressed = false
@stopped_doc = false
@track_visibility = true
end

Expand Down Expand Up @@ -205,7 +206,7 @@ def documented?
def done_documenting=(value)
return unless @track_visibility
@done_documenting = value
@document_self = !value
@document_self = !value unless @stopped_doc
@document_children = @document_self
end

Expand Down Expand Up @@ -343,6 +344,7 @@ def start_doc
@document_children = true
@ignored = false
@suppressed = false
@stopped_doc = false
end

##
Expand Down
1 change: 1 addition & 0 deletions lib/rdoc/markup/pre_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def handle_directive(prefix, directive, param, code_object = nil,
return blankline unless code_object

code_object.stop_doc
code_object.instance_variable_set(:@stopped_doc, true)

blankline
when 'yield', 'yields' then
Expand Down
24 changes: 24 additions & 0 deletions test/rdoc/rdoc_rdoc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,30 @@ def test_parse_file_encoding
tf.close!
end

def test_parse_file_stopdoc_in_c
@rdoc.store = RDoc::Store.new(@options)

temp_dir do |dir|
@rdoc.options.root = Pathname(Dir.pwd)

File.write 'test.c', <<~C
void Init_test(void) {
VALUE rb_cParent = rb_define_class("Parent", rb_cObject);

/* :stopdoc: */
VALUE cInternal = rb_define_class_under(rb_cParent, "Internal", rb_cObject);
/* :startdoc: */
}
C

top_level = @rdoc.parse_file 'test.c'

internal = @rdoc.store.find_class_named 'Parent::Internal'
assert internal, 'Parent::Internal should exist'
refute internal.document_self, 'Parent::Internal should have document_self=false after :stopdoc:'
end
end

def test_parse_file_forbidden
omit 'chmod not supported' if Gem.win_platform?
omit "assumes that euid is not root" if Process.euid == 0
Expand Down
Loading