Skip to content

Commit 1217d94

Browse files
committed
Fix array except! method to modify self
1 parent c7d4ea1 commit 1217d94

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/bitbucket_rest_api/core_ext/array.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ def except(*keys) # :nodoc:
44
self.dup.except!(*keys)
55
end unless method_defined?(:except)
66

7-
# TODO except! should moodify self not a copy
87
def except!(*items) # :nodoc:
9-
copy = self.dup
10-
copy.reject! { |item| items.include? item }
11-
copy
8+
self.reject! { |item| items.include? item }
129
end unless method_defined?(:except!)
1310

1411
def extract_options!

spec/bitbucket_rest_api/core_ext/array_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
end
1414

1515
describe '#except!' do
16-
xit 'removes the keys from the self' do
16+
it 'removes the keys from the self' do
1717
array = [:a, :b, :c, :d]
1818
array.except!(:a, :b)
1919

0 commit comments

Comments
 (0)