Much of Ruby’s appeal comes from its flexible syntax. You can find an example of this flexiblity even in the most basic program:
puts 'Hello, world'
Newcomers to Ruby often mistake puts for a language keyword, when it’s actually a method. People usually leave out the parentheses when calling puts, so it doesn’t look like a method. Reinsert the parentheses, and the nature of puts becomes obvious:
Thanks to disguised method calls such as this one, Ruby manages to provide many useful function-like methods while keeping the core of the language relatively small and uncluttered.
This simple idea of dropping parentheses from method calls is used quite often by expert coders. Sometimes you’ll want to keep ...