diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-12-20 19:35:59 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-12-20 19:35:59 +0900 |
commit | 4b6e3f7b82e03d6eb6562631365d35abaee35fb3 (patch) | |
tree | f1d67fab0a399463a959945781c1a7b3f6d77d85 /lib | |
parent | 37987d99940f10bc6fec9b4825d7ce72df391d42 (diff) |
irb: Define extension command on the given object
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/extend-command.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 02b7869569..347323247e 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 |