No, == not a special method in Ruby. This is a method like any other. What you see is just a parsing issue:
ax foo 4
coincides with
ax(foo(4))
IOW, you pass foo(4) as an argument to x , but x does not accept any arguments.
There is, however, a special operator syntax that allows you to write
a == b
instead
a.== b
for a limited list of operators:
== != < > <= >= <=> === & | * / + - % ** >> << !== =~ !~
In addition, there is a special syntax that allows you to write
and
~a
instead
a.!
and
a.~
Like
+a
and
-a
instead
a.+@
and
a.-@
Then there is
a[b]
and
a[b] = c
instead
a.[] b
and
a.[]= b, c
and finally no less
a.(b)
instead
a.call b
source share