implement ruler func