From: pharrington Date: 2010-02-04T13:15:09+09:00 Subject: Re: hooking subscript operations in a hash On Feb 3, 10:50 pm, Marnen Laibow-Koser wrote: > Ralph Shnelvar wrote: > > [...] > > > Is there any way to do it for all hash subscript operations? > > Using include instead of extend should do the trick.  You may also need > to alias the old Hash#[]= and then call it from your new one. > > Best, > --  > Marnen Laibow-Koserhttp://www.marnen.org > mar...@marnen.org > -- > Posted viahttp://www.ruby-forum.com/. eh as Rick already pointed out includ'ing a module will insert the module above the including class, so the original class's method still gets called. You'll need to "monkey patch" Hash's []=, and alias the original []= prior-to.