Padding zeros in front of a number using String#rjust

'12'.rjust(7,'0') #=> "0000012"

Resources