Makersquare coding challenge using Ruby