mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Hash instead of Set
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
583d903c2b
commit
89e82a75a8
1 changed files with 2 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue