From: Arlen Cuss Date: 2008-05-02T19:07:46+09:00 Subject: Re: Extracting a value from an array ------=_Part_9704_9897889.1209722865018 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, On Fri, May 2, 2008 at 7:34 PM, 7stud -- wrote: > > I've compressed your loop into this: > > > > (headers.select{ |h| h[:name] == 'content-length' }.first)[:value] > > That seems pretty typical of ruby programmers: cram everything into one > line and call it "clear". > It's still done in a very neat fashion, and the one that makes the most sense from a functional programming point of view. Speaking as objectively as possible, it's better than perhaps your proposal since it accurately shows what we're doing (`selecting' item hs where the [:name] is 'content-length', then picking the `first' and getting the [:value]..), and doesn't rely on creating new local variables. Arlen ------=_Part_9704_9897889.1209722865018--