title: Create an array with a fixed size, and fill default content with another array?
body: <p>I want to create a fixed size array with a default number of elements already filled from another array, so lets say that I have this method:</p>
  
  <pre><code>def fixed_array(size, other)
    array = Array.new(size)
    other.each_with_index { |x, i| array[i] = x }
    array
  end
  </code></pre>
  
  <p>So then I can use the method like:</p>
  
  <pre><code>fixed_array(5, [1, 2, 3])
  </code></pre>
  
  <p>And I will get</p>
  
  <pre><code>[1, 2, 3, nil, nil]
  </code></pre>
  
  <p>Is there an easier way to do that in ruby? Like expanding the current size of the array I already have with nil objects?</p>