how can I create _[ args ]()
method in one class?
like said here How does defining [square bracket] method in Ruby work?
a[b] is the same as a.[](b)
a[b] = c is the same as a.[]=(b, c)
I want to do the same thing but with my special characters, like :
my_instance_['foo'] have to be same as my_instance._[]('foo')
my_instance_[:bar] = :baz have to be same as my_instance._[]=(:bar, :baz)
"_[]" special named method with no "()" needed, and no "." point too, when call it.
How writte declaration of this method in ruby?
thx.