1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/irb] Symbol.all_symbols was adopted by Ruby 1.8.0 or later

https://github.com/ruby/irb/commit/71ba754e8e
This commit is contained in:
aycabta 2020-07-24 23:48:32 +09:00
parent 5474007d61
commit 6f0ef83de7

View file

@ -97,17 +97,13 @@ module IRB
when /^(:[^:.]*)$/
# Symbol
return nil if doc_namespace
if Symbol.respond_to?(:all_symbols)
sym = $1
candidates = Symbol.all_symbols.collect do |s|
":" + s.id2name.encode(Encoding.default_external)
rescue Encoding::UndefinedConversionError
# ignore
end
candidates.grep(/^#{Regexp.quote(sym)}/)
else
[]
sym = $1
candidates = Symbol.all_symbols.collect do |s|
":" + s.id2name.encode(Encoding.default_external)
rescue Encoding::UndefinedConversionError
# ignore
end
candidates.grep(/^#{Regexp.quote(sym)}/)
when /^::([A-Z][^:\.\(]*)$/
# Absolute Constant or class methods