Skip to content

Commit

Permalink
Suppress "method redefined" warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Apr 29, 2020
1 parent cdbb9df commit 5f0aee5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/irb/extend-command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ def #{cmd_name}(*opts, &b)
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
Expand Down

0 comments on commit 5f0aee5

Please sign in to comment.