[Rails] how to monkeypatch Hash's []= method, revisted

2009-05-18 Thread Darren
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%27s+%5B%5D%3D+method+#58b80fe0d4eadb1a But while reading, and admittedly not quite getting the

[Rails] how to monkeypatch Hash's []= method

2009-01-06 Thread Harold
I'm trying to monkeypatch the []= method in the Hash class: Hash.class_eval do def []_with_feature=(a,b) puts 'foo' end alias_method_chain :[]=, :feature end Something is wrong with the syntax, but I can't figure out what. The alias_method_chain method does look for punctuation (= in t