One thing I always see come up in discussions of Ruby and its syntax is the omission of parentheses. To provide an example:
some_object.ambiguous_middle.do_thing(:arg1, :arg2)
The common complaint being that the user is unable to determine from this notation if ambiguous_middle
is a property or method of some_object
.
This distinction does not exist in Ruby. Everything is a method call, there are no naked properties.
Even data structure objects such as Array and Hash are the same way. my_hash[:key]
is actually a method call.
class MyClass def [](key) key.upcase end end my_class = MyClass.new() my_class["this is a string"] => "THIS IS A STRING"
Hopefully it is easier now to see things like ambiguous_middle
for what they are: method calls with no arguments.