Refactor Ruby "x ? x.y : nil" to "x && x.y", which is more readable.