Added function #nearest_rank to Rank module