From: "Iñaki Baz Castillo" Date: 2008-04-30T22:11:07+09:00 Subject: Re: How to create "def method(item)= (value)" ? 2008/4/30, David A. Black : > You could also do: > > def param[]=(key,value) > @params[key] = value > end > > object.param[key] = value That's not valid, a method cannot contain []: irb> def hola[]() end SyntaxError: compile error syntax error, unexpected '[', expecting '\n' or ';' def hola[]() end > Of course, then one might as well do: > > attr_reader :params > > on the object, and them: > > object.params[key] = value Yes, but that is not valid for me since I need to exec some extra code so I need to create an abstraction layer to access @params. Thanks. -- Iñaki Baz Castillo