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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6823ffbec6e0af47c86993266ec50abe?d=identicon&s=25 Darren Bishop (gem_install_darren)
on 2009-05-18 10:01
(Received via mailing list)
So google for a solution to this problem and found myself here:

http://groups.google.com/group/rubyonrails-talk/br...

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
This topic is locked and can not be replied to.