Skip to content

Commit 6aaba60

Browse files
author
Sven Riedel
committed
Output all class docs if multiple classes are found for the same search term (this happens when gems like ActiveSupport extend core classes)
1 parent b204274 commit 6aaba60

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/bri.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def self.ri( query )
1818
"No matching results found"
1919
elsif results.size == 1
2020
results.first.to_s
21+
elsif results.all? { |r| r.is_a?(Bri::Match::Class) }
22+
results.map(&:to_s)
2123
else
2224
qualified_methods = results.map(&:full_name).sort
2325
ERB.new( Bri::Templates::MULTIPLE_CHOICES, nil, '<>' ).result( binding )

lib/bri/search/class.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module Search
33
class Class < Base
44
def search( type = :fully_qualified )
55
# NOTE: classes are only searched as fully qualified for the time being
6-
# FIXME: What do we do if more than one store defines the same class?
7-
store = Bri::Mall.instance.stores.detect { |s| s.module_names.include?( @term ) }
8-
@matches << Bri::Match::Class.new( store.load_class( @term ), store ) if store
6+
Bri::Mall.instance.stores.select { |s| s.module_names.include?( @term ) }.each do |store|
7+
@matches << Bri::Match::Class.new( store.load_class( @term ), store )
8+
end
99
end
1010
end
1111
end

0 commit comments

Comments
 (0)