From: Jason Roelofs Date: 2007-03-01T05:33:34+09:00 Subject: Re: Overload [] operator and use a block ? ------=_Part_49167_3589991.1172694811057 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Did you try to and find an error? Jason On 2/28/07, St=E9phane Wirtel wrote: > > Hi all, > > I would like to know if it's possible to overload the [] operator to > use a block with it. > > example: > > class Test > def []( x ) > # to do something here > yield if block_given? > end > end > > t =3D Test.new > t['string'] do > puts 'this is a test' > end > > Thanks > > > ------=_Part_49167_3589991.1172694811057--