Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between .at_css to .css in Nokogiri?

I can't find a clear, direct answer, but what's the difference between .at_css and .css in Nokogiri?

like image 534
Ariel Avatar asked Mar 15 '11 17:03

Ariel


1 Answers

Nokogiri has synonyms for the search-and-find-everything, and the find-the-first-one methods.

search, /, xpath and css all search for every occurrence of the accessor and return a NodeSet.

at, %, at_xpath and at_css search for the first occurrence and return a Node. That is why the docs say they're equivalent to saying search('//some/path').first or css('some path').first.

like image 89
the Tin Man Avatar answered Oct 24 '22 06:10

the Tin Man