From: "Nation, Carey" Date: 2011-02-04T01:56:46+09:00 Subject: Re: Setter method for Hash value Try calling it props= for the method name itself. Something like def props=(key, value) maybe? -----Original Message----- From: Rolf Pedersen [mailto:rolfhsp@gmail.com] Sent: Thursday, February 03, 2011 11:12 AM To: ruby-talk ML Subject: Setter method for Hash value Hi I guess there is a simple solution to this, but right now, I can't come up with it. I want to wrap two external functions to behave like a regular hash. class MyClass def props some_data = SomeClass::get_prop some_data.to_h end def props[key]=(value) # Not a valid construct SomeClass::set_prop(key, value) end end props["timeout"] =>"10" props["timeout"]="20" => nil Now, the getter method works perfectly, but I don't know how to declare the setter method :o( Anyone? Kind regards, Rolf