Method: SXRB::Proxy#descendant

Defined in:
lib/sxrb/proxy.rb

#descendant(*tags) {|Proxy| ... } ⇒ nil

TODO:

Add Regexp and other selectors support in addition to strings.

Defines descendant of an element defined in current block.

Parameters:

  • tags (String)

    names of tags that should be matched

Yields:

  • (Proxy)

    block receives Proxy element representing matched elements.

Returns:

  • (nil)


49
50
51
52
53
54
55
# File 'lib/sxrb/proxy.rb', line 49

def descendant(*tags, &block)
  tags.each do |tag|
    @callback_tree.add_rule(tag, @current_path, :recursive => true).tap do |new_path|
      block.call(Proxy.new(@callback_tree, new_path))
    end
  end
end