Should you write this if...else statement in Ruby instead of JS?