Method: Nokogiri::XML::Node#matches!
- Defined in:
- lib/ryoba/nokogiri/xml/node.rb
#matches!(selector) ⇒ self
Like Node#matches?, but returns the Node if selector
matches, and raises an error otherwise.
81 82 83 84 85 86 87 |
# File 'lib/ryoba/nokogiri/xml/node.rb', line 81 def matches!(selector) if !self.matches?(selector) abbreviated = self.to_html[/[^>]+>/] raise Ryoba::Error.new("Node #{abbreviated} does not match #{selector.inspect}") end self end |