|
|
|
|
|
by riffraff
5192 days ago
|
|
this is not true: ||= expands to @variable = @variable || @other_variable
I am not sure if semantics of defined-or-assign operator changed in recent rubies, but ||= used to expand to foo or foo = bar.
Which is different in some edge cases, e.g. >> a= Hash.new(0)
=> {}
>> a[:key] ||= :v
=> 0
>> a
=> {}
>> a[:key] = a[:key] || :v
=> 0
>> a
=> {:key=>0}
|
|