title: Ruby Array Select - Nested Maps with Wildcard
body: <p>I've got a JSON response and I'd like to extract values for a given key across multiple indexes.</p>
  
  <pre><code>json_object['resources'].select {|a| a["type"] == "aws_subnet" &amp;&amp; a["name"] == "private"}.first["instances"]
  </code></pre>
  
  <p>This gets me an array of instances. Each instance contains an attributes map element, which then contains an ID element. All I'm trying to do is get an array of all the IDs. Doing the following:</p>
  
  <pre><code>json_object['resources'].select {|a| a["type"] == "aws_subnet" &amp;&amp; a["name"] == "private"}.first["instances"][0..3]["attributes"]["id"]
  </code></pre>
  
  <p>Gets me the dreaded:</p>
  
  <pre><code>TypeError (no implicit conversion of String into Integer)
  </code></pre>