From 89e82a75a8a247e946a1ec6d5ee8e10a0f634712 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 13 Mar 2018 01:28:28 +0000 Subject: [PATCH] Hash instead of Set git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb/completion.rb | 5 ++--- 1 file 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)