added rank() method

Vova, hi! I added rank() method and tests for it.