From: Hal Fulton Date: 2006-08-14T04:07:56+09:00 Subject: Re: A use case for an ordered hash Mauricio Fernandez wrote: > > # But this would be nicer > class Array > def cassoc(x) # "case assoc" > each{|arr| return arr if arr[0] === x} > nil > end > end > > re, action = actions.cassoc("abcdef") > action and action.call # => 1 > re, action = actions.cassoc("abcx") > action and action.call # => 3 > Now, that's clever. That's probably the least painful solution I've seen using arrays. I still wish we had a so-called ordered hash. ;) Hal