From: Robert Klemme Date: 2006-09-28T15:45:11+09:00 Subject: Re: Ahh, the hazards of an interpretive language... Pete wrote: >> Btw, the typical solution in Ruby would be to use a Hash. Then tt >> will boil down to "def tt(x) your_hash[x] end". The next best >> solution (and also more similar to what you did) is a case statement > Yes, of course, but the actual actions were rather more complex than > just returning a value. That was just for illustration... In that case you could even put lambdas in the Hash and execute them: def tt(x) code[x][] end > I could (and probably eventually would) have used a case, as there > were several other possible flag values, but code evolves, y'know... > (:-)) Refactor, refactor, refactor! :-) Kind regards robert