Fix most of rubocop warnings

Avoid multi-line ?: (the ternary operator); use `if`/`unless` instead.