rubocop: fix offences of the Lint/ReturnInVoidContext cop

This commit is contained in:
Kyrylo Silin 2019-03-04 00:56:31 +02:00
parent 850ac861d0
commit 11f798d300
2 changed files with 5 additions and 6 deletions

View File

@ -13,11 +13,6 @@ Gemspec/RequiredRubyVersion:
Exclude:
- 'pry.gemspec'
# Offense count: 1
Lint/ReturnInVoidContext:
Exclude:
- 'lib/pry/command_set.rb'
# Offense count: 1
Lint/ShadowedException:
Exclude:

View File

@ -325,7 +325,11 @@ class Pry
# Pry.config.commands["help"] = MyHelpCommand
#
def []=(pattern, command)
return @commands.delete(pattern) if command.equal?(nil)
if command.equal?(nil)
@commands.delete(pattern)
return
end
unless Class === command && command < Pry::Command
raise TypeError, "command is not a subclass of Pry::Command"
end