title: Ruby: undefined method `[]' for nil:NilClass when trying to get Enumerator on an Array of Hashes
body: <p>I am trying to loop on an Array of Hashes. When I reach the point where I fetch the Enumerator to start looping, I get the following error:</p>
  
  <pre><code>undefined method `[]' for nil:NilClass
  </code></pre>
  
  <p>My code looks like the following:</p>
  
  <pre><code>def extraireAttributs (attributsParam)
    classeTrouvee = false
    scanTrouve = false
    ownerOSTrouve = false
    ownerAppTrouve = false
    resultat = Hash.new(0)
    attributs = Array(attributsParam)
  
    attributs.each do |attribut| #CRASHES HERE!!!
      typeAttribut = attribut['objectTypeAttribute']
      [...]
  </code></pre>
  
  <p>I checked in debug mode to make sure the <code>attributsParams</code>argument and the <code>attributs</code>variable are not nil or empty. Both (because they are the same!) contain 59 Hashes objects, but I still cannot get an Enumerator on the Array. </p>
  
  <p>Why do I keep on getting this error?</p>
  
  <p>Thanks!</p>