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\
>= Ruby 2.4:
{a: 'asd', b: nil}.compact => {:a=>"asd"}