On Mon, Oct 11, 2010 at 2:05 PM, Charles Calvert <cbciv / yahoo.com> wrote:
> I'm using Ruby 1.8.7 patchlevel 249
>
> Is there a more idiomatic way to do the following?
>
> var = hash[key].nil? ? nil : hash[key].downcase

I see nothing wrong with an explicit approach.  Here is an alternative, though:

var = hash[key].downcase rescue nil


Kirk Haines