title: How to use variable in Nokogiri contains
body: <p>I have an XML file like:</p>
  
  <pre><code>&lt;main&gt;
    &lt;key&gt;xxx&lt;/key&gt;
    &lt;key&gt;yyy&lt;/b&gt;
    &lt;key&gt;zzz&lt;/key&gt;
  &lt;/main&gt;
  </code></pre>
  
  <p>To check whether the XML has a node with text "yyy", I can use:</p>
  
  <pre><code>xml = Nokogiri::XML(file)
  if xml.at('main/key:contains("yyy")')
    #code will go here
  end
  </code></pre>
  
  <p>But if the text value is a variable how can I use the same statement?
  Note: I have tried below solution and it doesn't work:</p>
  
  <pre><code>var = "yyy"
  if xml.at("main/key:contains(#{var})")
  </code></pre>