Not quite a direct response, but the ||= idiom is also handy for these
things
ie:

irb(main):001:0> a = nil
irb(main):002:0> b = 4
irb(main):003:0> b ||= 7
=> 4
irb(main):004:0> b
=> 4
irb(main):005:0> a ||= b
=> 4
irb(main):006:0> a
=> 4

  .adam