Found another question that seemed to be solved by using .sprintf(‘%02d’, 1) to solve this, but I get: ‘private method `sprintf’ called for 7:Fixnum’.
Does this mean sprintf cant be called on an integer or am I getting it wrong in the calling?
Just looking to pad single digit returns with a leading 0.
Thanks in advance for any help on this!
you may want to try
"0#{num}"[-2..-1]or"%02d" % 1