From: Cory Chamblin Date: 2010-03-06T05:07:37+09:00 Subject: Re: Conditional keys in hash - out of the box? Jes炭s Gabriel y Gal叩n wrote: > One liner: > > mymethod(h = {:this => 'green'} && condition ? h.merge({:that => > 'blue'}) : h) > You could also do it this way: method {:Apples => 1}.merge(condition ? {:Oranges => 2} : {}) -- Posted via http://www.ruby-forum.com/.