1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/irb] Suppress "method redefined" warning

https://github.com/ruby/irb/commit/5f0aee56fa
This commit is contained in:
aycabta 2020-04-28 17:07:27 +09:00
parent 3864fbc6d8
commit 7e5253d15e

View file

@ -173,11 +173,14 @@ module IRB # :nodoc:
args << "&block"
args = args.join(", ")
line = __LINE__; eval %[
def #{cmd_name}(\#{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