Skip to content

Commit 13dfc46

Browse files
committed
Performance/HashEachMethods
1 parent 5272b3d commit 13dfc46

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ Naming/HeredocDelimiterNaming:
5151
Exclude:
5252
- 'tasks/compile.rake'
5353

54-
# Offense count: 2
55-
# Cop supports --auto-correct.
56-
# Configuration parameters: AutoCorrect.
57-
Performance/HashEachMethods:
58-
Exclude:
59-
- 'benchmark/active_record.rb'
60-
- 'benchmark/allocations.rb'
61-
6254
# Offense count: 2
6355
# Cop supports --auto-correct.
6456
# Configuration parameters: MaxKeyValuePairs.

benchmark/active_record.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestModel < ActiveRecord::Base
2323

2424
x.report(adapter) do
2525
TestModel.limit(batch_size).to_a.each do |r|
26-
r.attributes.keys.each do |k|
26+
r.attributes.each_key do |k|
2727
r.send(k.to_sym)
2828
end
2929
end

benchmark/allocations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def bench_allocations(feature, iterations = 10, batch_size = 1000)
2424

2525
bench_allocations('coercion') do |batch_size|
2626
TestModel.limit(batch_size).to_a.each do |r|
27-
r.attributes.keys.each do |k|
27+
r.attributes.each_key do |k|
2828
r.send(k.to_sym)
2929
end
3030
end

0 commit comments

Comments
 (0)