diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 828103ccc9..2f4fcfb5c6 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -173,11 +173,14 @@ module IRB # :nodoc: 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