Install
sudo gem install nokogiri
Contribute
github.com/tenderlove/nokogiri

An HTML, XML, SAX, & Reader parser with the ability to search documents via XPath or CSS3 selectors… and much more

Nokogiri

Module Nokogiri::Decorators::Slop

 

The Slop decorator implements method missing such that a methods may be used instead of XPath or CSS. See Nokogiri.Slop

Public Instance Methods

method_missing(name, *args, &block) Show Source
 

look for node with name. See Nokogiri.Slop

# File lib/nokogiri/decorators/slop.rb, line 9 9: def method_missing name, *args, &block 10: if args.empty? 11: list = xpath("./#{name}") 12: elsif args.first.is_a? Hash 13: hash = args.first 14: if hash[:css] 15: list = css("#{name}#{hash[:css]}") 16: elsif hash[:xpath] 17: conds = Array(hash[:xpath]).join(' and ') 18: list = xpath("./#{name}[#{conds}]") 19: end 20: else 21: CSS::Parser.without_cache do 22: list = xpath( 23: *CSS.xpath_for("#{name}#{args.first}", :prefix => "./") 24: ) 25: end 26: end 27: 28: super if list.empty? 29: list.length == 1 ? list.first : list 30: end