Methods

Class Index [+]

Quicksearch

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) click to toggle 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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.