ruby-changes:64384
From: Nobuyoshi <ko1@a...>
Date: Sun, 20 Dec 2020 19:37:07 +0900 (JST)
Subject: [ruby-changes:64384] 4b6e3f7b82 (master): irb: Define extension command on the given object
https://git.ruby-lang.org/ruby.git/commit/?id=4b6e3f7b82 From 4b6e3f7b82e03d6eb6562631365d35abaee35fb3 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 20 Dec 2020 19:35:59 +0900 Subject: irb: Define extension command on the given object diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 02b7869..3473232 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -177,9 +177,9 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/extend-command.rb#L177 args << "&block" args = args.join(", ") line = __LINE__; eval %[ - unless self.singleton_class.class_variable_defined?(:@@#{cmd_name}_) - self.singleton_class.class_variable_set(:@@#{cmd_name}_, true) - def #{cmd_name}_(\#{args}) + unless singleton_class.class_variable_defined?(:@@#{cmd_name}_) + singleton_class.class_variable_set(:@@#{cmd_name}_, true) + def self.#{cmd_name}_(\#{args}) ExtendCommand::#{cmd_class}.execute(irb_context, \#{args}) end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/