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
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 /^(:[^:.]*)$/
|
when /^(:[^:.]*)$/
|
||||||
# Symbol
|
# Symbol
|
||||||
return nil if doc_namespace
|
return nil if doc_namespace
|
||||||
if Symbol.respond_to?(:all_symbols)
|
sym = $1
|
||||||
sym = $1
|
candidates = Symbol.all_symbols.collect do |s|
|
||||||
candidates = Symbol.all_symbols.collect do |s|
|
":" + s.id2name.encode(Encoding.default_external)
|
||||||
":" + s.id2name.encode(Encoding.default_external)
|
rescue Encoding::UndefinedConversionError
|
||||||
rescue Encoding::UndefinedConversionError
|
# ignore
|
||||||
# ignore
|
|
||||||
end
|
|
||||||
candidates.grep(/^#{Regexp.quote(sym)}/)
|
|
||||||
else
|
|
||||||
[]
|
|
||||||
end
|
end
|
||||||
|
candidates.grep(/^#{Regexp.quote(sym)}/)
|
||||||
|
|
||||||
when /^::([A-Z][^:\.\(]*)$/
|
when /^::([A-Z][^:\.\(]*)$/
|
||||||
# Absolute Constant or class methods
|
# Absolute Constant or class methods
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue