Symbol#to_proc & Method Objects

Why map(&:name) works β€” finally explained

You've written walkers.map(&:name) for modules. Here's the machinery, and it's a favorite interview probe. & expects a proc; if you give it something else, Ruby calls to_proc on it first. Symbol#to_proc turns :name into the proc ->(x) { x.name }. So &:name becomes "call .name on each element."

In an interview, say: "&:name is & coercing the symbol via Symbol#to_proc into ->(x){ x.name }, then expanding that proc into the block. It's shorthand for { |x| x.name } β€” great for single no-arg method calls, useless the moment you need arguments."