Made if statement comply to ruby style guide