Skip to content

Add HTML fragment references for constants #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions lib/rdoc/constant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def == other
@name == other.name
end

##
# HTML fragment reference for this Constant

def aref
"#constant-#{full_name}"
end

##
# A constant is documented if it has a comment, or is an alias
# for a documented class or module.
Expand Down
4 changes: 4 additions & 0 deletions test/rdoc/test_rdoc_constant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def setup
@const = @c1.constants.first
end

def test_aref
assert_equal '#constant-C1::CONST', @const.aref
end

def test_documented_eh
top_level = @store.add_file 'file.rb'

Expand Down