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

ruby-changes:60941

From: aycabta <ko1@a...>
Date: Wed, 29 Apr 2020 19:14:32 +0900 (JST)
Subject: [ruby-changes:60941] 7e5253d15e (master): [ruby/irb] Suppress "method redefined" warning

https://git.ruby-lang.org/ruby.git/commit/?id=7e5253d15e

From 7e5253d15ea1d2cdfc7942213f9c7ba79c3eda2b Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Tue, 28 Apr 2020 17:07:27 +0900
Subject: [ruby/irb] Suppress "method redefined" warning

https://github.com/ruby/irb/commit/5f0aee56fa

diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 828103c..2f4fcfb 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -173,11 +173,14 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/extend-command.rb#L173
             args << "&block"
             args = args.join(", ")
             line = __LINE__; eval %[
-              def #{cmd_name}(\#{args})
-            ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
+              unless self.class.class_variable_defined?(:@@#{cmd_name}_)
+              self.class.class_variable_set(:@@#{cmd_name}_, true)
+                def #{cmd_name}_(\#{args})
+                  ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
+                end
               end
             ], nil, __FILE__, line
-            send :#{cmd_name}, *opts, &b
+            send :#{cmd_name}_, *opts, &b
           end
         ], nil, __FILE__, line
       else
-- 
cgit v0.10.2


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

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