summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-07-24 23:48:32 +0900
committeraycabta <aycabta@gmail.com>2020-08-18 14:38:01 +0900
commit6f0ef83de7f8b9cda1bd9247a2c57b27278e3565 (patch)
treea69fb1c4bb0dd56ed8dc74445eefed3f29c29ffe /lib
parent5474007d6119a5ac021bc9fc1bbf932aab5f0dbb (diff)
[ruby/irb] Symbol.all_symbols was adopted by Ruby 1.8.0 or later
https://github.com/ruby/irb/commit/71ba754e8e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/completion.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index c44aa9039e..0d5420bc75 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -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