This code invokes Array::[] with 1, 2 and 3 as arguments:
Array[1, 2, 3] #=> [1, 2, 3]
But this doesn’t seem to call Array::[]:
[1, 2, 3] #=> [1, 2, 3]
So, which method is invoked by [...] in Ruby?
Motivation: I’m trying to stub the method in a test.
This is literal syntax for an array. It’s not a message send. Ruby, like the vast majority of other languages, doesn’t allow overloading of literals.
If you need literal overloading, you should use a language which does support it, such as Ioke.