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:         prefix = implied_xpath_context
11: 
12:         if args.empty?
13:           list = xpath("#{prefix}#{name.to_s.sub(/^_/, '')}")
14:         elsif args.first.is_a? Hash
15:           hash = args.first
16:           if hash[:css]
17:             list = css("#{name}#{hash[:css]}")
18:           elsif hash[:xpath]
19:             conds = Array(hash[:xpath]).join(' and ')
20:             list = xpath("#{prefix}#{name}[#{conds}]")
21:           end
22:         else
23:           CSS::Parser.without_cache do
24:             list = xpath(
25:               *CSS.xpath_for("#{name}#{args.first}", :prefix => prefix)
26:             )
27:           end
28:         end
29: 
30:         super if list.empty?
31:         list.length == 1 ? list.first : list
32:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.