title: Ruby array access 2 consecutive(chained) elements at a time
body: <p>Now, This is the array,</p>
  
  <pre><code>[1,2,3,4,5,6,7,8,9]
  </code></pre>
  
  <p>I want,</p>
  
  <pre><code>[1,2],[2,3],[3,4] upto [8,9]
  </code></pre>
  
  <p>When I do, each_slice(2) I get,</p>
  
  <pre><code>[[1,2],[3,4]..[8,9]]
  </code></pre>
  
  <p>Im currently doing this,</p>
  
  <pre><code>arr.each_with_index do |i,j|
    p [i,arr[j+1]].compact #During your arr.size is a odd number, remove nil.
  end
  </code></pre>
  
  <p>Is there a better way??</p>