Ruby: Triangle classifier