:to_s is a symbol, not a method. Therefore, you cannot pass any arguments, for example :to_s(2) . If you do, you will receive an error message. How your code will not work. Thus, [1, 2, 3].map(&:to_s(2)) impossible, where possible [1, 2, 3].map(&:to_s) . &:to_s means that you call the #to_proc method on a character. Now in your case &:to_s(2) means :to_s(2).to_proc . Error before calling the #to_proc method.
:to_s.to_proc # => #<Proc:0x20e4178> :to_s(2).to_proc # if you try and the error as below syntax error, unexpected '(', expecting $end p :to_s(2).to_proc ^
Now try your own and compare the error with the above explanation:
[1, 2, 3].map(&:to_s(2)) syntax error, unexpected '(', expecting ')' [1, 2, 3].map(&:to_s(2)) ^
source share