title: Ruby: elegant array initialization and return in Ruby
body: <p>I have a method:</p>
  
  <pre><code>def deltas_to_board_locations(deltas, x, y)
      board_coords = []
      deltas.each_slice(2) do |slice|
        board_coords &lt;&lt; x + slice[0] 
        board_coords &lt;&lt; y + slice[1]
      end
      board_coords
    end 
  </code></pre>
  
  <p>where deltas is an array, and x,y are fixnums.</p>
  
  <p>Is there a way to eliminate the first and last line to make the method more elegant? </p>
  
  <p>Like:</p>
  
  <pre><code>def deltas_to_board_locations(deltas, x, y)
      deltas.each_slice(2) do |slice|
        board_coords &lt;&lt; x + slice[0] 
        board_coords &lt;&lt; y + slice[1]
      end
    end 
  </code></pre>