Refactor a hard-to-read `unless/else` chain in scaler.rb