title: Get inner text of nearest parent a tag
body: <p>I'm using Ruby &amp; Nokogiri to parse html on a page.</p>
  
  <pre><code>&lt;div&gt;&lt;a href="#" title="firstTitle"&gt;text one&lt;/a&gt;&lt;/div&gt;
  
    &lt;p class="OK"&gt;some content&lt;/p&gt;
    &lt;p class="OK"&gt;some content&lt;/p&gt;
  
  &lt;div&gt;&lt;a href="#" title="secondTitle"&gt;text two&lt;/a&gt;&lt;/div&gt;
  
    &lt;p class="WARNING"&gt;some content&lt;/p&gt;
    &lt;p class="WARNING"&gt;some content&lt;/p&gt;
  
  &lt;div&gt;&lt;a href="#" title="thirdTitle"&gt;text three&lt;/a&gt;&lt;/div&gt;
  
    &lt;p class="CRITICAL"&gt;some content&lt;/p&gt;
    &lt;p class="CRITICAL"&gt;some content&lt;/p&gt;
  </code></pre>
  
  <p>Say I want to find paragraphs with a class of <code>WARNING</code>, I can do that successfully with:</p>
  
  <pre><code>doc = Nokogiri::HTML(html)
  warning = doc.css('p.WARNING')
  </code></pre>
  
  <p>But now I want to target the inner text of the nearest parent <code>a</code> tag, in this case it would return <code>text two</code>.</p>
  
  <p>I've tried using <code>.first.parent.name</code> and <code>previous_element</code> among other variations but have not been successful and would appreciate some insight. Thanks!</p>