Forum: Ruby on Rails how to monkeypatch Hash's []= method, revisted

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Darren B. (Guest)
on 2009-05-18 12:01
(Received via mailing list)
So google for a solution to this problem and found myself here:

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)

Hope it helps
This topic is locked and can not be replied to.