This code calls Array::[] with 1 , 2 and 3 as arguments:
Array::[]
1
2
3
Array[1, 2, 3] #=> [1, 2, 3]
But this is not like Array::[] :
[1, 2, 3] #=> [1, 2, 3]
So, which method is called [...] in Ruby?
[...]
Motivation: I'm trying to drown out a method in a test.
This is the literal syntax for an array. This is not a message. Ruby, like most other languages, does not allow literals to be overloaded.
If you need literal overload, you should use a language that supports it, such as Ioke.
Source: https://habr.com/ru/post/1436189/More articles:What do I need to install on Java programming? - javaC unsigned long long and imulq - cServicestack.net Mini razor profiler - servicestackLittle problem loading libgdx - javapytest: pytest_sessionstart () and pytest_sessionfinish () are valid interceptors? - py.testAbility to run chrome with extensions downloaded by watir-webdriver - google-chrome-extensionMakefile - just do the installation (copy the files), there is no purpose for the assembly - cGet last row from filtered range - vbaDisable SSL with Scala Dispatcher Library - scalaHow to split a pattern according to a specific variable in Stata? - sampleAll Articles