code as module method with specs

Prefer `.to_i` over `.to_int`