Proc syntax question


I’ve been passing methods as into enumerables and will usually do something like: { |int| int.length }


array.sort_by { |word| word.length }

However Rubocop keeps suggesting that I use:

I understand that the & is needed to pass and a block into a functions by converting it to a proc e.g.,:

def test(val, &proc1) { |n| n ** 2 }
# do stuff

However it’s a little lost on me as to why I need to reference a symbol with the method name. In the case of ‘&:length’, what is the reason that I need to convert ‘:length’ (&:length) into a proc instead of ‘length’ (&length)? It’s a bit confusing since length isn’t a block but a method.

Thanks in advance,