ruler function