diff options
Diffstat (limited to 'lib/irb/extend-command.rb')
-rw-r--r-- | lib/irb/extend-command.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/irb/extend-command.rb b/lib/irb/extend-command.rb index 4018eb13a6..8e985274b1 100644 --- a/lib/irb/extend-command.rb +++ b/lib/irb/extend-command.rb @@ -256,13 +256,12 @@ module IRB # :nodoc: end if load_file - kwargs = ", **kwargs" if RUBY_VERSION >= "2.7.0" line = __LINE__; eval %[ - def #{cmd_name}(*opts#{kwargs}, &b) + def #{cmd_name}(*opts, **kwargs, &b) Kernel.require_relative "#{load_file}" arity = ::IRB::ExtendCommand::#{cmd_class}.instance_method(:execute).arity args = (1..(arity < 0 ? ~arity : arity)).map {|i| "arg" + i.to_s } - args << "*opts#{kwargs}" if arity < 0 + args << "*opts, **kwargs" if arity < 0 args << "&block" args = args.join(", ") line = __LINE__; eval %[ @@ -273,7 +272,7 @@ module IRB # :nodoc: end end ], nil, __FILE__, line - __send__ :#{cmd_name}_, *opts#{kwargs}, &b + __send__ :#{cmd_name}_, *opts, **kwargs, &b end ], nil, __FILE__, line else |