Add serialize in and out functions in ruler