From: Eero Saynatkari Date: 2006-08-11T09:22:14+09:00 Subject: Re: Overriding String#[] Lukasz Muziol wrote: > The generic question would be "does anyone know a decent and complete > reference to Ruby's syntax?" > > What interests me is the syntax required to define methods like [], []=, > getting their parameters in between the braces. It's fairly > inconvienient that String#[] returns a character code, rather than a > string of one character. Hope it'll get changed soon (to get in line > with POLS perhaps :)), accomodating my laziness for now I hope to > override it. How do I define a function named like this? def [](key) # ... end def []=(key, value) # ... end > Thanks. -- Posted via http://www.ruby-forum.com/.