Is there a nice (one line) way of writing a hash in ruby with some entry only there if a condition is fulfilled? I thought of
{:a => \'a\', :b => (\'b\
My one-liner solution:
{:a => 'a'}.tap { |h| h.merge!(:b => 'b') if condition }