From: "Thomas W." Date: 2011-03-04T02:10:26+09:00 Subject: How to assign an element to a hash only if its value is not nil? hash = {} hash[:key] = myvalue How to assign hash[:key] only if myvalue is not nil? Current solution is: hash[:key] = myvalue unless myvalue.nil? Is there something more beautiful? -- Posted via http://www.ruby-forum.com/.