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:
parent
5474007d61
commit
6f0ef83de7
1 changed files with 6 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue