title: How to avoid NoMethodError for nil elements when accessing nested hashes?
body: <p>If I try to access a hash element that isn't present, I get <code>NoMethodError: undefined method '[]' for nil:NilClass</code>. However, I can't predict which elements will be present.</p>
  
  <pre><code>@param_info = {}
  @param_info["drug"]["name"]
  # =&gt; NoMethodError: undefined method `[]' for nil:NilClass
  </code></pre>
  
  <p>How can I avoid raising this error when an element is unexpectedly <code>nil</code>?</p>