title: Finding indexes of each element in a multidimensional array in ruby
body: <p>Eg </p>
  
  <pre><code>:a=[["hello", "world"], ["good", "lord"], ["hello", "lord"]]
  </code></pre>
  
  <p>I need to find and record the indexes of each word with respect to the super-array.
  i.e </p>
  
  <pre><code>hello =&gt; 0,2
  world =&gt; 0
  lord =&gt; 1,2.
  </code></pre>
  
  <p>here's my shot ,but its very amateurish and lengthy. </p>
  
  <pre><code>all_tokens=tokens.flatten
  all_tokens.each do|keyword|                                                                                      
      tokens.each do|token_array|
          if token_array.include?keyword
              x &lt;&lt; i
          end
          i=i+1
      end    
      y[k] = x.clone
      y=y.clear
  end 
  </code></pre>