From: "Mikael Høilund" Date: 2008-05-30T07:05:19+09:00 Subject: Re: Quickie: Monkey patching Array On May 29, 2008, at 23:51, Leon Bogaert wrote: > Hi all, > > A quick question: is it possible to monkey patch the Array [] method > in > ruby? > > I tried: > > class Array > def []=(elem) You monkey patched the []= method, not the [] method. Try def [](index) Also: Are you sure this is necessary? I can only imagine overwriting Array#[] can lead to bad things. -- # Mikael Høilund def method_missing(m, a=0) a + m.to_s[/[a-z]+/].size * 2; end p What is the meaning of life?