- I know we can define
[](arg)in ruby class as bracket method - I know we can omit
self.when calling instance method inside the class
But the following wouldnt work:
class Example
def [](position)
...
end
def test(position)
if [position] == 3 # doesn't work
end
end
I know it's probably because [position] might refers to creating an array with position, but is this documented anywhere?