Skip to content

Commit 71ba754

Browse files
committed
Symbol.all_symbols was adopted by Ruby 1.8.0 or later
1 parent b9938c6 commit 71ba754

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/irb/completion.rb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,13 @@ def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace
9797
when /^(:[^:.]*)$/
9898
# Symbol
9999
return nil if doc_namespace
100-
if Symbol.respond_to?(:all_symbols)
101-
sym = $1
102-
candidates = Symbol.all_symbols.collect do |s|
103-
":" + s.id2name.encode(Encoding.default_external)
104-
rescue Encoding::UndefinedConversionError
105-
# ignore
106-
end
107-
candidates.grep(/^#{Regexp.quote(sym)}/)
108-
else
109-
[]
100+
sym = $1
101+
candidates = Symbol.all_symbols.collect do |s|
102+
":" + s.id2name.encode(Encoding.default_external)
103+
rescue Encoding::UndefinedConversionError
104+
# ignore
110105
end
106+
candidates.grep(/^#{Regexp.quote(sym)}/)
111107

112108
when /^::([A-Z][^:\.\(]*)$/
113109
# Absolute Constant or class methods

0 commit comments

Comments
 (0)