title: Nokogiri check if value exists
body: <p>I'm scraping some web stuff and I get the following error, </p>
  
  <p><strong>scrape.rb:27:in <code>block in &lt;main&gt;': undefined method</code>text' for nil:NilClass (NoMethodError)</strong></p>
  
  <p>when running my ruby task, due to the css not containing any content inside.</p>
  
  <p>Is there a way to check if CSS is not undefined so it wont stop crawling? My code wont work :(</p>
  
  <pre><code>products.each do |product|
  
       web = Nokogiri::HTML(open(product))
  
        counter = products.index(product)
  
        if web.at_css('.entry-title').text != undefined
        puts "CSS content is not undefined"
        else
        puts "Error"
        end
  </code></pre>