Skip to content

Commit

Permalink
Add select! and reject! to the list InverseMethods will check for
Browse files Browse the repository at this point in the history
  • Loading branch information
rrosenblum authored and bbatsov committed Feb 24, 2017
1 parent 0c9ed7c commit 905adb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/default.yml
Expand Up @@ -721,6 +721,7 @@ Style/InverseMethods:
# of the block that is passed to the method
InverseBlocks:
:select: :reject
:select!: :reject!

Style/Lambda:
EnforcedStyle: line_count_dependent
Expand Down
7 changes: 5 additions & 2 deletions spec/rubocop/cop/style/inverse_methods_spec.rb
Expand Up @@ -17,7 +17,8 @@
:> => :<=
},
'InverseBlocks' => {
select: :reject
select: :reject,
select!: :reject!
}
}
)
Expand Down Expand Up @@ -147,7 +148,9 @@

context 'inverse blocks' do
{ select: :reject,
reject: :select }.each do |method, inverse|
reject: :select,
select!: :reject!,
reject!: :select! }.each do |method, inverse|
it "registers an offense for foo.#{method} { |e| !e }" do
inspect_source(cop, "foo.#{method} { |e| !e }")

Expand Down

0 comments on commit 905adb4

Please sign in to comment.