Use
size
instead of count
.72
73
74# Raises "Use `size` instead of `count`"
75[1, 2, 3].count
Description
size
should be preferred over count
. Read more here.
Bad practice
[1, 2, 3].count
{a: 1, b: 2, c: 3}.count
Recommended
[1, 2, 3].size
{a: 1, b: 2, c: 3}.size
[1, 2, 3].count { |e| e > 2 }