aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/completion.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-13 01:28:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-13 01:28:28 +0000
commit89e82a75a8a247e946a1ec6d5ee8e10a0f634712 (patch)
tree3441dfeb8f37d408101cee9bec0cc8b5ccfeb325 /lib/irb/completion.rb
parent583d903c2ba5de82bd3eb2eb687b1c107938f9e2 (diff)
downloadruby-89e82a75a8a247e946a1ec6d5ee8e10a0f634712.tar.gz
Hash instead of Set
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/completion.rb')
-rw-r--r--lib/irb/completion.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 1b9d96b8f9..319cb84303 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -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)