From: Luc Heinrich Date: 2008-05-02T22:35:14+09:00 Subject: Re: Extracting a value from an array On 2 mai 08, at 15:31, Luc Heinrich wrote: > content_type_header = lambda { |h| h[:name] == 'content-type' } > content_type = headers.find(&content_type_header).fetch(:value) if > headers.any?(&content_type_header) Or, since you can pass a proc to the find method which gets called when nothing is found, this: content_type = headers.find(lambda {Hash.new}) { |h| h[:name] == 'content-type' }.fetch(:value, nil) -- Luc Heinrich - luc@honk-honk.com