git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-03-13 01:28:28 +00:00
Родитель 583d903c2b
Коммит 89e82a75a8
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -214,12 +214,11 @@ module IRB
# We could cache the result, but this is very fast already.
# By using this approach, we avoid Module#name calls, which are
# relatively slow when there are a lot of anonymous modules defined.
require 'set'
s = Set.new
s = {}
scanner = lambda do |m|
next if s.include?(m) # IRB::ExtendCommandBundle::EXCB recurses.
s << m
s[m] = true
m.constants(false).each do |c|
value = m.const_get(c)
scanner.call(value) if value.is_a?(Module)