3 ms·
I use this to memoize instance vars from time to time, whenever nil could be considered valid return x if defined? x x = ingest_stock_market `defined
by the_sleaze_ 2y ago
I use this to memoize instance vars from time to time, whenever nil could be considered valid
return x if defined? x
x = ingest_stock_market
`defined?` won't evaluate the parameter either which is nice whereas things like blank? present? and presence do
- JadeNB 2y ago> return x if defined? x It's a natural pattern, and translates with obvious changes to Perl, but still `x = defined? x ? x : y` is longer than `x //= y`, so all I was meaning to say in my original comment was that I was surprised that Ruby didn't borrow the latter from Perl.