Ruby is basically 100% object-oriented, but sometimes it tries to hide this fact for... convenience? Familiarity?
Basically functions defined "at the top level" are really defined as methods on a global object. To make that work, a call without a specifier is really converted to calling a method with that name on said global object. This style makes things look more script-y. Ruby is trying to do that with your last example.
The first two examples parse fine because Ruby knows you are trying to access the methods of the proc object--remember even []
is just a method you can define. The one with the explicit dot also works because the dot means "send this message to this object" (in this case, a
).
I know that doesn't "solve" anything, but I hope it helps a bit.