||= is a very useful technique in Ruby programming and is used like:
x ||= 5
It relies on nil evaluating as false. It works like this: a variable is equal to its value xor some other value. If the variable is nil, then the other value is used. Otherwise, it keeps its value.
irb(main):001:0> x ||= 5
=> 5
irb(main):002:0> x
=> 5
irb(main):003:0> y=2
=> 2
irb(main):004:0> y ||= 7
=> 2
irb(main):005:0> z
NameError: undefined local variable or method `z' for main:Object
from (irb):5
from :0
irb(main):006:0> z=nil
=> nil
irb(main):007:0> z ||= 3
=> 3
irb(main):008:0> m
NameError: undefined local variable or method `m' for main:Object
from (irb):8
from :0
irb(main):009:0> m ||= 1
=> 1
irb(main):010:0>