How to monkeypatch Hash's []= method, revisted


#1

So google for a solution to this problem and found myself here:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/eaa34998a74831b4/58b80fe0d4eadb1a?lnk=gst&q=+how+to+monkeypatch+Hash's+[]%3D+method+#58b80fe0d4eadb1a

But while reading, and admittedly not quite getting the solution, I
had a bright moment to balance out the stupid moment, realising that []
= already has an alias to which you can delegate:

class Hash
def []= key, value
store processKey(key), processValue(value)
end
end

Hope it helps