Skip to content
Open
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
5 changes: 2 additions & 3 deletions lib/rdoc/code_object/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -779,9 +779,8 @@ def find_class_method_named(name)
# Finds a constant with +name+ in this context

def find_constant_named(name)
@constants.find do |m|
m.name == name || m.full_name == name
end
name = name[2..-1] if name&.start_with?('::')
@constants.find { |m| m.name == name || m.full_name == name }
end

##
Expand Down
1 change: 1 addition & 0 deletions test/rdoc/rdoc_context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ def test_find_class_method_named
def test_find_constant_named
assert_nil @c1.find_constant_named('NONE')
assert_equal ':const', @c1.find_constant_named('CONST').value
assert_equal ':const', @c1.find_constant_named('::CONST').value
end

def test_find_enclosing_module_named
Expand Down
Loading