title: Format integer to string with fixed length in Ruby
body: <p>Is there a easy way to format a given Integer to a String with fixed length and leading zeros?</p>
  
  <pre><code># convert numbers to strings of fixed length 3 
  [1, 12, 123, 1234].map { |e| ??? }
  =&gt; ["001", "012", "123", "234"]
  </code></pre>
  
  <p>I found a solution but maybe there is a smarter way.</p>
  
  <pre><code>format('%03d', e)[-3..-1]
  </code></pre>