[前][次][番号順一覧][スレッド一覧]

ruby-changes:62608

From: aycabta <ko1@a...>
Date: Tue, 18 Aug 2020 18:57:01 +0900 (JST)
Subject: [ruby-changes:62608] 6f0ef83de7 (master): [ruby/irb] Symbol.all_symbols was adopted by Ruby 1.8.0 or later

https://git.ruby-lang.org/ruby.git/commit/?id=6f0ef83de7

From 6f0ef83de7f8b9cda1bd9247a2c57b27278e3565 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Fri, 24 Jul 2020 23:48:32 +0900
Subject: [ruby/irb] Symbol.all_symbols was adopted by Ruby 1.8.0 or later

https://github.com/ruby/irb/commit/71ba754e8e

diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index c44aa90..0d5420b 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -97,17 +97,13 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L97
       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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]