summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 19:35:59 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 19:35:59 +0900
commit4b6e3f7b82e03d6eb6562631365d35abaee35fb3 (patch)
treef1d67fab0a399463a959945781c1a7b3f6d77d85
parent37987d99940f10bc6fec9b4825d7ce72df391d42 (diff)
irb: Define extension command on the given object
-rw-r--r--lib/irb/extend-command.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb
index 02b78695697..347323247e1 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -177,9 +177,9 @@ module IRB # :nodoc:
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